Given a bijection $q: \mathbb{N} \rightarrow \mathbb{Z} \times \mathbb{Z}$, find $q(1000)$

elementary-set-theoryfunctions

We were given a bijection of $q: \mathbb{N} \rightarrow \mathbb{Z} \times \mathbb{Z}$ that spirals out from $(0,0)$.

This is the only description of the function given.

I need to find $q(1000)$. I noticed that the top left and bottom right corners of each "spiral" are squares of incrementing even and odd integers in $\mathbb{N}$. How would I go about getting the point $q(1000)$?

Edit: The original bijection is from $\mathbb{N} \rightarrow \mathbb{Z} \times \mathbb{Z}$. The numbers on each point are incremented values from the previous point on the spiral, not coordinates.

Best Answer

As you noticed, the integer $(2N)^2$ gets mapped to the top left of the "spiral". Now just notice that this top left coordinate is always of the form $(-N,N)$. Since, $32^2 = 1024$ and $32 = 2(16)$, we have that $q(1024) = (-16,16)$. To find $q(1000)$, we move the point $(-16,16)$ to the right $24$ times (or in other words add $24$ to the $x$ coordinate) and get that $q(1000)= (8,16)$.

Also what you're noticing about the top left and bottom right corners can be viewed as a consequence of the formula

$$1 + 3 + 5 + 7 + ... + (2n - 1) = n^2 $$

Related Question