ElegantPairingInt | R Documentation |
Unordered Pairing Function creating a new unique integer from two input integers.
ElegantPairingInt(int1, int2)
int1 |
first integer to be paired. |
int2 |
second integer to be paired. |
With two of non-negative integers x and y as an input, the pairing is computed as:
elegantPairing(x, y) = (x * y) + floor ((|x - y| - 1)^2) / 4)
The function is commutative. x and y have to be non-negative integers.
The function outputs a single non-negative integer that is uniquely associated with that unordered pair.
Szudzik, M. (2006): An Elegant Pairing Function. Wolfram Science Conference NKS 2006.
ElegantPairingVec
ElegantPairingInt(2, 3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.