ElegantPairingInt: Elegant Pairing

View source: R/RcppExports.R

ElegantPairingIntR Documentation

Elegant Pairing

Description

Unordered Pairing Function creating a new unique integer from two input integers.

Usage

ElegantPairingInt(int1, int2)

Arguments

int1

first integer to be paired.

int2

second integer to be paired.

Details

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.

Value

The function outputs a single non-negative integer that is uniquely associated with that unordered pair.

Source

Szudzik, M. (2006): An Elegant Pairing Function. Wolfram Science Conference NKS 2006.

See Also

ElegantPairingVec

Examples


ElegantPairingInt(2, 3)


PPRL documentation built on Nov. 10, 2022, 5:41 p.m.

Related to ElegantPairingInt in PPRL...