|
EXAMPLE
|
a(8) = 39814 because starting with S=[0,1,2,3,4,5,6,7], the 8 swaps applied are:
i | j | S (after i-th swap).
--------------------------
0 | 1 | [1, 0, 2, 3, 4, 5, 6, 7]
1 | 3 | [1, 3, 2, 0, 4, 5, 6, 7]
2 | 0 | [2, 3, 1, 0, 4, 5, 6, 7]
3 | 4 | [2, 3, 1, 4, 0, 5, 6, 7]
4 | 1 | [2, 0, 1, 4, 3, 5, 6, 7]
5 | 4 | [2, 0, 1, 4, 5, 3, 6, 7]
6 | 1 | [2, 6, 1, 4, 5, 3, 0, 7]
7 | 0 | [7, 6, 1, 4, 5, 3, 0, 2]
And then the Lexicographic rank of S=[7, 6, 1, 4, 5, 3, 0, 2] is 39814.
|