Create an iterator that combines the permutations of the integers from 1 to 3 with three bit binary Gray code.
>
|
|
Print the first 10 iterations, along with the rank.
>
|
|
1: 1 2 3 0 0 0
2: 1 3 2 0 0 0
3: 2 1 3 0 0 0
4: 2 3 1 0 0 0
5: 3 1 2 0 0 0
6: 3 2 1 0 0 0
7: 1 2 3 1 0 0
8: 1 3 2 1 0 0
9: 2 1 3 1 0 0
10: 2 3 1 1 0 0
| |
Compute the number of iterations.
Compute the output with rank equal to 8.