# Bijection between natural numbers $\mathbb{N}$ and natural plane $\mathbb{N} \times \mathbb{N}$ [duplicate]

I know that is possible to build a bijection between the set of natural numbers $\mathbb{N}$ and the natural plane (the cartesian product of $\mathbb{N}$ by itself, $\mathbb{N} \times \mathbb{N} = \mathbb{N}^2$. This is done by diagonally traversing the plane from zero upwards with triangles of growing size.

Is there a simple algebraic form for that bijection? That is, is it possible to write explicitly some invertible $f(i, j): \mathbb{N} \times \mathbb{N} \leftrightarrow \mathbb{N}$?

I need to index in a simple way couples of natural numbers.

## marked as duplicate by Martin Sleziak, Asaf Karagila♦, Peter Taylor, Surb, Willie WongMar 31 '15 at 13:54

$$f(m,n)=2^m(2n+1)-1$$
• Why doesn't just $2^m(2n+1)$ work? – Nishant Aug 6 '14 at 4:45
• I assume that $0\in \mathbb{N}$ – AsdrubalBeltran Aug 6 '14 at 4:48
• Yeah, and if $0\notin\mathbb N$, then the RHS won't hit half the positive integers. – Nishant Aug 6 '14 at 13:20