Permutations to scalars and back again.

Peter Fairbrother peter at m-o-o-t.org
Mon Sep 19 15:02:36 PDT 2016


On 19/09/16 02:45, James A. Donald wrote:
> On 9/12/2016 8:01 PM, Georgi Guninski wrote:
>> On Mon, Sep 12, 2016 at 07:50:50PM +1000, James A. Donald wrote:
>>> To restate the problem:  Find a mapping between integers and injective
>>> functions from N to X up to a permutation of N.
>>>
>>> In this case, find a mapping between integers and an injective functions
>>> from 18 to 36.
>>
>> Sage (open source, sagemath.org) can do at least parts of what you
>> are asking.
>> Not sure I get the question about injective function, but AFAICT
>> treating the permutation as nonnegative integer in binary will do.
>>
>> Example sage session:
>>
>> sage: l=[0]*2+[1]*2
>> sage: pe=Permutations(l)
>> sage: pe.cardinality()
>> 6
>> sage: pe[0]
>> [0, 0, 1, 1]
>> sage: for p in pe:  print p
>> [0, 0, 1, 1]
>> #...more
>>
>>
>
>
> Found the the solution.
>
> Combinatorial number system.
>
> Suppose we have k cards, any one of which can be white or red, but which
> are otherwise indistinguishable and interchangeable.
>
> Combinatorial number system gives us a one to one mapping between
> integers, and all possible subsets of an n element set.
>
> Now I want a mapping between integers and all possible m element subsets
> of an n element set, but for m approximating n/2 the mapping is dense
> enough to be useful.

The mapping I described is a fully dense 1:1 bijective mapping between 
the 9075135300 possible ordered combinations of 18 zeros and 18 ones and 
the integers 0-9075135299.


If you didn't understand it, please ask, off- or on-list.

-- Peter F


More information about the cypherpunks mailing list