Showing a mapping has infinitely many solutions Problem: Define a mapping $\gamma\colon\mathbb{N}\to\mathbb{N}$ such that for each $n\in\mathbb{N}$ the equation $\gamma(x)=n$ has infinitely many solutions.
Book solution: Let $p_n$ denote the $n$th prime ($p_1=2, p_2=3, \ldots$). Define $\gamma$ by $\gamma(p_n^k)=n$ for $k=1,2,3,\ldots$; $\gamma(m)$ can then be anything for $m$ not a prime power. 
My solution: Define $\gamma$ by $\gamma(n\cdot\cos(\pi/2\cdot k))=n$ for $k=1,2,3,\ldots$. Doesn't this work? It seems like there are so many trivial ways to answer this problem correctly or am I missing something? 
$\color{red}{\text{Edit: Concerning the book's solution:}}$ Suppose $\gamma(x)=5$. Then solutions are $$p_5^k=11^k=\underbrace{11,121,\ldots}_{\text{infinitely many}},$$
where there are evidently infinitely many solutions. Is my understanding correct? 

The books solution is very nice. Yours doesn't work, because $\cos(\frac{\pi}{2} \cdot k)$ will only produce a few different values as $k$ varies. So even though you've constructed a different equation that has infinite solutions (all the $k$s), the solutions to the new equation don't all produce distinct solutions to the original equation.
Here's how I would do it, in the style of the book's solution to your other question.
$\gamma(0) = 0,$
$\gamma(1) = 0, \gamma(2) = 1,$
$\gamma(3) = 0, \gamma(4) = 1, \gamma(5) = 2,$
$\gamma(6) = 0, \gamma(7) = 1, \gamma(8) = 2, \gamma(9) = 3,$
And so on.
