$f:\Bbb Z\to\Bbb Z$ such that $f(f(n)-2n)=2f(n)+n$ for all $n\in\Bbb Z$ Does there exists a function $f:\Bbb Z\to\Bbb Z$ such that $$f(f(n)-2n)=2f(n)+n$$ for all $n\in\Bbb Z$
 A: Any $n\in{\mathbb Z}$ can be uniquely
written
$$
n=x2^y, \ x\in{\mathbb Z},y\in{\mathbb Z}^{+},x \ \rm{odd}.
$$
(this follows from unique prime factorization). The exponent $y$ above is denoted by
$\nu_2(n)$. If you put
$$
g(n)=\left\lbrace\begin{array}{lcl}
2n & \rm if & \nu_2(n) \ \text{is even} \\
\frac{5n}{2} & \rm if & \nu_2(n) \ \text{is odd}
\end{array}\right.
$$
then $g(g(n))=5n$, and hence $f(n)=g(n)+2n$ is a solution, as dhrab noted.
There are many variations to this construction, of course.
A: Hint:
Let $f$ be such a function and have a look at $g\left(n\right):=f\left(n\right)-2n$.
Then $g\left(g\left(n\right)\right)=5n$.
The question is now reduced to: does there exist a function $g:\mathbb{Z}\rightarrow\mathbb{Z}$
such that $g\left(g\left(n\right)\right)=5n$ for each $n\in\mathbb{Z}$?
If so then $f$ defined by $f\left(n\right)=g\left(n\right)+2n$ meets
the conditions.
A: Thanks to drhab, we know that the equation is equivalent to $g(g(n))=5n$ where $g(n)=f(n)-2n$. Now, we can classify all such $g$.
Obviously, $g(0)=0$, while there is no other fixed point $n$ with $g(n)=n$ since that would make $g(g(n))=n$ rather than $5n$. Also, $g$ must be injective since
$$
g(n)=g(m)\implies g(g(n)=g(g(m))\implies 5n=5m\implies n=m.
$$
Let $A_0=\mathbb{Z}\setminus\text{Im}(g)$, i.e. the set of values not in the image of $g$, and $A_k=g(A_{k-1})$ for $k=1,2,\ldots$. As $g(g(n))=5n$, $A_{k+2}=g(g(A_k))=5A_k$. The image of the composition $g\circ g$ is $5\mathbb{Z}$, and so $A_0\cup A_1=\mathbb{Z}\setminus 5\mathbb{Z}$: i.e. $A_0$ and $A_1$ together contain exactly the integers that are not divisible by 5.
If $A_0=\{u_1,u_2,\ldots\}$, then $A_1=\{v_1,v_2,\ldots\}$ where $v_i=g(u_i)$. Furthermore, this makes $g(v_i)=5u_i$. Expanded to $A_{2k}=5^kA_0$ and $A_{2k+1}=5^kA_1$, this makes
$$
g(5^ku_i)=5^kv_i \quad\text{and}\quad g(5^kv_i)=5^{k+1}u_i.
$$
Conversely, any splitting of $\mathbb{Z}\setminus 5\mathbb{Z}$ into to disjoint sets $A_0$ and $A_1$ and a one-to-one map $g:A_0\rightarrow A_1$ (defining $v_i=g(u_i))$ as above) will extend uniquely to a map $g:\mathbb{Z}\rightarrow\mathbb{Z}$ with $g(g(n))=5n$.
To summarise, any function $g:\mathbb{Z}\rightarrow\mathbb{Z}$ with $g(g(n))=5n$ can be defined by selecting two series $u_1,u_2,\ldots$ and $v_1,v_2,\ldots$ so that every integer not divisible by 5 appears exactly once in one of the two series, and then define
$$
g(5^ku_i)=5^kv_i \quad\text{and}\quad g(5^kv_i)=5^{k+1}u_i
\quad\text{for}\quad k=0,1,\ldots.
$$
A: If $n\in \Bbb N$ such that $5^k\le n \le 3(5^k)$ for some $k\in \{0,1,2,\dots\}$, then we define $$g(n)=n+2(5^k)$$
and if $n\in \Bbb N$ such that $3(5^k)\le n\le 5^{k+1}$ for some $k\in \{0,1,2,\dots\}$, then we define $$g(n)=5n-2(5^{k+1})$$
and if $n$ is a negative integer number, then we let $g(n)=-g(-n)$ with $g(0)=0$.
