I was recently writing a program that needed to encode a permutation
into a single integer number (an index, from 0 to n! - 1).
The program transformed the permutation (f.i., of 5 numbers) into
a "series of indexes", in the ranges [0..4], [0..3], [0..2], [0..1],
4 indexes in total (one...