Pairing function
From Wikipedia, the free encyclopedia
In mathematics a pairing function is a process to uniquely encode two natural numbers into a single natural number.
Any pairing function can be used in set theory to prove that integers and rational numbers have the same cardinality as natural numbers. In theoretical computer science they are used to encode a function defined on a vector of natural numbers f:Nk β N into a new function g:N β N.
[edit] Definition
A pairing function is a bijective function
[edit] Cantor pairing function
The Cantor pairing function is a pairing function
defined by
When we apply the pairing function to k1 and k2 we often denote the resulting number as
This definition can be inductively generalized to the Cantor tuple function
as
[edit] References
- Weisstein, Eric W., Pairing function at MathWorld.