Cantorparingfunksjon
The Cantor pairing function is a computable bijection from the set of pairs of natural numbers to the set of natural numbers. It was invented by Georg Cantor. The function, often denoted by $\pi(k_1, k_2)$, takes two non-negative integers $k_1$ and $k_2$ and returns a unique non-negative integer. This means that every possible pair of natural numbers can be represented by a distinct natural number, and conversely, every natural number corresponds to exactly one pair of natural numbers.
The standard formula for the Cantor pairing function is $\pi(k_1, k_2) = \frac{1}{2}(k_1 + k_2)(k_1 + k_2 + 1) + k_2$.
The inverse functions, which recover the original pair from a given natural number, are also computable. Given