|
#1
|
|||
|
|||
Re: Enumerating Groups - Algorithm
Ideally, I want only unique permutations. So I could use that method, but with binary.
ABCDEF 000111 = DEF 001111 = CDEF I would have to check to see if the binary representation had a different number of 1's than 3. |
#2
|
|||
|
|||
Re: Enumerating Groups - Algorithm
Yes, that's what I meant by requiring that the checksum is 3. The only valid numbers for you are ones in which the sum of the digits is 3. That is why you have to do a little bit of combinatorics to convert from the binary number to the enumeration.
If the first 1 is in digit x (counting from the right), second 1 in digit y (again counting from the right) and third 1 is in digit z, then I think that the number in the enumeration is (x-1 choose 3) + (y-1 choose 2)+ (z-1)+1 |
#3
|
|||
|
|||
Re: Enumerating Groups - Algorithm
To go backwards, i.e. to figure out which group of 3 corresponds to n in your enumeration, find x such that (x choose 3) >= n > (x-1 choose 3), and put a 1 in digit x (counting from the right). Then find y such that (y choose 2) >= n-(x-1 choose 3) > (y-1 choose 2), and put a 1 in digit y. Find z similarly.
For n=13, (6 choose 3) >= 13 > (5 choose 3), so we put a 1 in the 6th digit from the right, i.e., we include A. (3 choose 2) = 13-(5 choose 3) > (2 choose 2), so we put a 1 in the 3rd digit from the right. (2 choose 1)= 13-(5 choose 3)-(2 choose 2)> (1 choose 1), so we put a 1 in the 2nd digit from the right, giving us the element 100110, or ADE. |
|
|