Combinatorial number system
ID: combinatorial-number-system
At a fixed positive integer level , the combinatorial number system writes each positive integer uniquely asChoose as large as possible with , subtract that term and repeat at level , stopping when the remainder is zero. For example, at level three,Pascal's identity gives , so the remainder after choosing the level- term is smaller than . The next top index is consequently strictly smaller. Hockey-stick identity also bounds the sum of all lower admissible terms by . Thus those terms cannot replace a larger level- choice, proving uniqueness. The zero integer has the empty representation. This correspondence is useful for ranking and unranking fixed-size subsets.
New to topics? Read the docs here!