ToLehmerCode from Permutation
Entry i counts the later entries smaller than p(i).
Its total is the inversion count, which is the Lehmer code's whole point.
Called as CombinatorialMap(x, "ToLehmerCode"). The head's page has its examples.
Entry i counts the later entries smaller than p(i).
Permutation → PermutationInversion
Its total is the inversion count, which is the Lehmer code's whole point.
Called as CombinatorialMap(x, "ToLehmerCode"). The head's page has its examples.