= Factoradic indexing
<Factoradic indexing> uses the <factorial number system> to rank or unrank <permutations> of an ordered $n$-element set. For zero-based rank $r<n!$, write $r=\sum_{k=1}^{n-1}d_k k!$ with $0\le d_k\le k$. Read the digits from highest factorial down, selecting the indexed item from the remaining ordered elements and removing it.
For rank $4$ among permutations of $(a,b,c)$, $4=2\cdot2!+0\cdot1!$. Select index $2$, giving $c$, then index $0$, giving $a$, then the remaining $b$: the result is $cab$. This produces a <bijection> between ranks $0,\ldots,n!-1$ and lexicographically ordered <permutations>.
Back to article page