Combinatorial number system
This online calculator represents given natural number as sequences of k-combinations, referred as the combinatorial number system of degree k (for some positive integer k), aka combinadics
This online calculator converts natural number from decimal number system to so-called combinadics, or combinatorial number system of degree k. In this system, the number N is represented as sum of binomials:
,
and sequence of strictly decreasing coefficients is the combinatorial representaton of N in combinatorial number system of degree k.
This representation is actually a bijection between natural number N and k-combination taken from N, so you can generate the k-combination at index N, which has some useful applications.
How to convert
You should enter a number to convert and desired combinatorial number system degree in the fields below, and the calculator shows you the representation and detail of conversion.
The conversion algorithm is described below the calculator.
Algorithm to find the k-combination for a given number
Finding the k-combination for a given number is called unranking and there is a simple greedy algorithm to do it:
- Find maximum which holds
- Find maximum which holds
- ...
- Find maximum which holds
Note that if . It is used to pad sum with zeroes, as you can see in the example above. In such cases, algorithm assigns the maximum possible value:
Comentários