LehmerCodes
The Lehmer code of every permutation of — inversion tables with .
LehmerCodes(n)the Lehmer code of every permutation of — inversion tables with Typed signatures
| Type | Package | Applies |
|---|---|---|
(integer<0..>) -> indexed_collection<permutation_inversion> | combinatorics | always |
Details
- Count is (A000142); order-isomorphic to SymmetricGroup via the Lehmer code bijection.
- Each element is the code itself, not the permutation it decodes to.
Definition
Epsil, as the implementation runs it.
count(_n)
_n!unrank(_n, _r)
Map(
Function((_r - _r % (_n - j)!) / (_n - j)! % (_n - j + 1), j),
Range(1, _n, 1),
)rank(_n, _x)
Fold(Function(lr * (_n - lj + 1) + _x[lj], lr, lj), 0, Range(1, _n, 1))valid(_n, _x)
Fold(
Function(ok_lj && 0 <= _x[lj] && _x[lj] <= _n - lj, ok_lj, lj),
True,
Range(1, _n, 1),
) if Length(_x) == _n else FalseMaps
Into and out of PermutationInversion, called as CombinatorialMap(x, "Name"). Properties are the laws we state and what FindStat records.
To PermutationInversion
- ToLehmerCodePermutation → PermutationInversionEntry i counts the later entries smaller than p(i).
Enumeration
Examples
1 more kept as data, checked against the oracles See also: SymmetricGroup, SubexcedantSeqs, Inversions