Lehmer code

In mathematics and in particular in combinatorics, the Lehmer code is a particular way to encode each possible permutation of a sequence of n numbers. It is an instance of a scheme for numbering permutations and is an example of an inversion table.

The Lehmer code is named in reference to D. H. Lehmer, but the code had been known since 1888 at least.