Permutations, Lehmer Code, and Lexicographic Index

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.
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.


  • [Snapshot]
  • [Snapshot]
  • [Snapshot]


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

Embed Interactive Demonstration New!

Just copy and paste this snippet of JavaScript code into your website or blog to put the live Demonstration on your site. More details »

Files require Wolfram CDF Player or Mathematica.

Mathematica »
The #1 tool for creating Demonstrations
and anything technical.
Wolfram|Alpha »
Explore anything with the first
computational knowledge engine.
MathWorld »
The web's most extensive
mathematics resource.
Course Assistant Apps »
An app for every course—
right in the palm of your hand.
Wolfram Blog »
Read our views on math,
science, and technology.
Computable Document Format »
The format that makes Demonstrations
(and any information) easy to share and
interact with.
STEM Initiative »
Programs & resources for
educators, schools & students.
Computerbasedmath.org »
Join the initiative for modernizing
math education.
Step-by-Step Solutions »
Walk through homework problems one step at a time, with hints to help along the way.
Wolfram Problem Generator »
Unlimited random practice problems and answers with built-in step-by-step solutions. Practice online or make a printable study sheet.
Wolfram Language »
Knowledge-based programming for everyone.
Powered by Wolfram Mathematica © 2018 Wolfram Demonstrations Project & Contributors  |  Terms of Use  |  Privacy Policy  |  RSS Give us your feedback
Note: To run this Demonstration you need Mathematica 7+ or the free Mathematica Player 7EX
Download or upgrade to Mathematica Player 7EX
I already have Mathematica Player or Mathematica 7+