WOLFRAM|DEMONSTRATIONS PROJECT

Functions That Enumerate Pairs

​
z
0
red point 0 ↦ {0,0}
blue point {0,0} ↦ 0
A function
f
that enumerates pairs is a bijective mapping of the set of non-negative integers to the set of all ordered pairs of non-negative integers. Thus there are three functions
i
,
k
,
l
that satisfy the relations
i(k(z),l(z))=z
,
k(i(x,y))=x
,
l(i(x,y))=y
, with
-1
f
=i
. One such triple is defined by
i(x,y)=(x+y)(x+y+1)/2+x
;
k(z)=z-u(u+1)/2
, where
u
is the largest integer for which
u(u+1)/2≤z;l(z)=u-k(z)
.