# A quick question, pls help

1. Apr 28, 2010

### Anzewill

Anyone can give me a example of a bijective fuction from N to N^2?

2. Apr 29, 2010

### HallsofIvy

I can't give you a simple "formula" but here is how to get a bijective function:

Write the numbers 1, 2, 3, ... horizontally and to left of "1" and slightly below write 1, 2, 3, ... vertically so that the cell below "m" and to the right of "n" is the pair (m,n). Now start at (1, 1) and "zigzag" through that array. That is, go from (1,1) horizontally to (2, 1) then diagonally, down and left, to (1,2), down to (1, 3), diagonally up and right to (2,3) and (3, 1), right to (4, 1), diagonally down to (3,2), etc.

3. Apr 30, 2010

### Martin Rattigan

Or for a simple formula try $(m,n)\rightarrow 2^m(2n+1)-1$.