TITLE: Bijection from $\Bbb N\to \Bbb Z \times \{1, 2, 3, 4\}$.
QUESTION [5 upvotes]: Find a bijection from $\Bbb N\to \Bbb Z \times \{1, 2, 3, 4\}$.
Ok, so I know some element $x$, in $\Bbb N$ maps to an element $(y,z)$ in $\Bbb Z.$
I know to to get from $x$ to $y.$
But since $z$ can only be $1,2, 3,$ or $4$, I'm lost.

REPLY [2 votes]: Define $\sigma: \Bbb Z \times \{1, 2, 3, 4\} \to  \Bbb Z \times \{1, 2, 3, 4\}$ by
$$   
    \sigma(z,k) = \left\{\begin{array}{lr}
        (z, k+1), & \text{for } z = 0 \, \land \, k \lt 4\\
        (-1, 1), & \text{for } z = 0 \, \land \, k = 4\\
        (z, k+1), & \text{for } |z| \gt 0 \, \land \, k \lt 4\\
        (-z, 1), & \text{for } z \lt 0  \, \land \, k = 4\\
        (-z-1, 1), & \text{for } z \gt 0  \, \land \, k = 4
        \end{array}\right\} 
$$
Exercise: Show that $n \mapsto \sigma^n(0,1)$ is a bijective mapping between $\{0,1,2,3,...\}$ and $\Bbb Z \times \{1, 2, 3, 4\}$.