A combinatorial base representation encodes an integer as a combination number: one of the values from 0 through (n choose k)−1. The encoding follows the lexicographic ordering of k-element combinations, with binomial coefficients dividing the search into ranges. section 6.3.2
To decode a value p, compare it with (n−1 choose k). If p falls below that boundary, exclude n−1; otherwise subtract the boundary and include n−1, then recurse on the smaller problem. section 6.3.2
Decoding a combination number
GetCombination(8, 6, 4) recursively partitions the combinations using binomial boundaries and returns the combination represented by rank 8. The same ordering appears in listings such as 0123, 0124, 0125, and 0134. section 6.3.2
