Permutations, Lehmer Code, and Lexicographic Index

​
permutation size
17
index = a +
31
2
b +
62
2
c
100000000000000
a
b
c
range
permutation
Lehmer code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
5
14
9
2
1
11
16
6
7
4
8
17
10
13
15
3
12
4
12
7
1
0
6
9
2
2
1
1
5
1
2
2
0
0
cycles
(1 5)(2 14 13 10 4)(3 9 7 16)(6 11 8)(12 17)(15)
graph
Gauss loop
The number of ways to arrange seventeen objects in a row is
17×16×15×14×13×12×11×10×9×8×7×6×5×4×3×2×1=355687428096000
, or
17!
for short. The arrangements are called permutations. Combinatorial theorists use five different notational systems for permutations.
Assume that the objects are labeled by the numbers 1 to 17. The first notation has positions on top and the numbers of the rearranged objects on the bottom. It can be read as a mapping of a finite set of numbers, where the numbers on top get mapped to those below.
The second notation is just the bottom row of the first notation. (5 14 9 2 1 11 16 6 7 4 8 17 10 13 15 3 12) is a permutation.
The third notation applies that mapping repeatedly to any starting number until there is a repetition. Then a new number is chosen to start the next cycle, and so on. (1 5)(2 14 13 10 4)(3 9 7 16)(6 11 8)(12 17)(15) is a cycle form. A permutation can be shown as a directed graph.
The fourth notation is the lexicographical index. The arrangement (5 14 9 2 1 11 16 6 7 4 8 17 10 13 15 3 12) is the hundred trillionth permutation if the permutations of 17 objects are sorted. Thus, 100000000000000 of 17! is a permutation.
The fifth notation is the Lehmer code, for example (4 12 7 1 0 6 9 2 2 1 1 5 1 2 2 0 0). The generating algorithm is basically "this number is greater than
n
of the subsequent numbers." This is also known as the factorial number system representation of a number. Note that
10000000000000=4×16!+12×15!+7×14!+1×13!+0×12!+6×11!+9×10!+2×9!+2×8!+1×7!+1×6!+5×5!+1×4!+2×3!+2×2!+0×1!+0×0!
.
Gauss noted that every self-intersecting closed loop with
n
crossings corresponds to a permutation by labeling every other intersection with 1 to
n
. The reverse is not true, since permutations like (3 4 5 1 2) lead to nonplanar graphs.
Big numbers are needed to get to 27!, but in a slider, only
31
2
=2147483648
discrete integer values are possible. Bigger numbers are split across sliders.

References

[1] Wikipedia. "Lehmer Code." (Sep 3, 2015) en.wikipedia.org/wiki/Lehmer_code.

External Links

Gauss Code Loops
Gray Indexed Minimum Change Permutation
Permutation Notations

Permanent Citation

Ed Pegg Jr
​
​"Permutations, Lehmer Code, and Lexicographic Index"​
​http://demonstrations.wolfram.com/PermutationsLehmerCodeAndLexicographicIndex/​
​Wolfram Demonstrations Project​
​Published: September 9, 2015