<s>[INST] Showing the range of a function The function $f:\mathbb{Z}\rightarrow\mathbb{Z}$ is defined by
$$f(n)=\begin{cases}3n+2\quad \text{if $n$ is even}\\ 2n+3\quad \text{if n is odd.}\end{cases}$$
Prove that the range of $f$ is $\{m\in\mathbb{Z}|m\equiv 1,2,5,8 \ \text{or} \ 9 \pmod {12}\}$  
I wasn't sure of a nice way to show this, so I just considered when $n = 2k$,
$f(n) = 6k+2$.
Then I found this modulo $12$ by considering when $k\equiv 0,1,2,3,\ldots,11$ mod $12$.
This seemed to alternate from $2$ to $8$.  
Then I considered when $n=2\ell +1$, and $\ell\equiv 0,1,2,\ldots,11$ mod $12$ and found the other results needed.  
However, the solutions did the exact same thing, except they considered when $k\equiv 0,1,2$ and $\ell \equiv 0,1,2$ both modulo $3$... not $12$.
Why does this work?
 [/INST] Since they're asking for a result modulo $12$, I would've gone for a more direct approach, like so:
$(3)(4) = 12$, so for the even cases, work modulo $4$. An even number $n$ satisfies $n \equiv 0,2 \pmod 4$. So $3n+2 = 2,8 \pmod{12}$.
$(2)(6) = 12$, so for the odd cases, work modulo $6$. An odd number $m$ satisfies $m \equiv 1,3,5 \pmod 6$. So $2n+3 \equiv 5,9,13 \equiv 5,9,1 \pmod{12}$.
So the complete range is $1,2,5,8,9 \pmod{12}$ as required.
</s>