Cantor pairing function
ID: cantor-pairing-function
The Cantor pairing function is an explicit bijection between and , with the natural numbers numbered from zero:If , there are pairs on earlier diagonals, and the pair is at offset along diagonal . The formula therefore gives exactly the enumeration above. For example, .
New to topics? Read the docs here!