Cantor Expands
The formula of Cantor expansion is X=an*(n-1)!+an-1*(n-2)!+…+ai*(i-1)!+…+a2 1!+a1 0! Among them , ai is the number (starting from 0) among the elements that do not appear currently.
Sequence an
012 210
ABC --> CBA
n=3
x=2*(3-1)!+1*(3-2)!+0*(3-3)!=2 2+1 1+0=5
ABC | 0
ACB | 1
BAC | 2
BCA | 3
CAB | 4
CBA |