Permutations, Lehmer Code, and Lexicographic Index

Requires a Wolfram Notebook System

Interact on desktop, mobile and cloud with the free Wolfram CDF Player or other Wolfram Language products.

Requires a Wolfram Notebook System

Edit on desktop, mobile and cloud with any Wolfram Language product.

The number of ways to arrange seventeen objects in a row is , or for short. The arrangements are called permutations. Combinatorial theorists use five different notational systems for permutations.

[more]

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 of the subsequent numbers." This is also known as the factorial number system representation of a number. Note that

.

Gauss noted that every self-intersecting closed loop with crossings corresponds to a permutation by labeling every other intersection with 1 to . 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 discrete integer values are possible. Bigger numbers are split across sliders.

[less]

Contributed by: Ed Pegg Jr (September 2015)
Open content licensed under CC BY-NC-SA


Snapshots


Details

Reference

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



Feedback (field required)
Email (field required) Name
Occupation Organization
Note: Your message & contact information may be shared with the author of any specific Demonstration for which you give feedback.
Send