TITLE: Sequence : $f(f(n))+f(n+1)=3n$
QUESTION [5 upvotes]: Does there exist a function $f : \mathbb{Z}^+ \to \mathbb{Z}^+$  such that $f(f(n))+f(n+1)=3n$, $\forall n \in \mathbb{Z}^+$ ?
My attempt :
Substitute $n=1$, $f(f(1))+f(2)=3$ so $f(2) \in \{1$ or $2\}$ 
If $f(2)=1, f(f(1))=2$ 
Substitute $n=2$, $f(f(2))+f(3)=6$ so $f(1)+f(3)=6$ 
Substitute $n=3$, $f(f(3))+f(4)=9$ 
If $f(2)=2$, $f(f(1))=1$ so $f(1)\not= 2$

REPLY [3 votes]: I claim that no such functions exist.
First, suppose $f(2)=2$. We get
$$f(f(2))+f(3)=6\Longrightarrow f(3)=4.$$
We get a contradiction, since
$$2f(4)=f(f(3))+f(4)=9.$$
Hence $f(2)=1$. As you said, $f(f(1))=2$, and in particular $f(1)\neq 2$. Let's go through all the cases of $f(1)$ (since $f(1)+f(3)=6$, there are only 5 cases):

$f(1)=1$; then $2=f(f(1))=f(1)=1$, a contradiction.
$f(1)=2$ was already ruled out.
$f(1)=3$; then $f(3)=3$. But also $f(3)=f(f(1))=2$, a contradiction.
$f(1)=4$; then $f(4)=f(f(1))=2$ and $f(3)=2$. We get a contradiction, since $9=f(f(3))+f(4)=f(2)+f(4)=4$.
$f(1)=5$; then $f(5)=f(f(1))=2$ and $f(3)=1$. Hence $$9=f(f(3))+f(4)=f(1)+f(4)=5+f(4),$$ implying $f(4)=4$. This does not work with $f(f(4))+f(5)=12$.

As a conclusion, there are no such functions.

REPLY [2 votes]: We will show that there is no such function. 
Since $f(2)+ff(1)=3$, we have two case:

$f(2)=2$:
$ff(2)+f(3)=6\implies f(3)=4$
$ff(3)+f(4)=9\implies 2f(4)=9$.
The last one is impossible hence $f(2)=1$.

$f(2)=1:$
$$
ff(2)+f(3)=6\implies f(3)=6-f(1)\\
ff(3)+f(4)=9\implies f(6-f(1))+f(4)=9.
$$ 
First of all $f(1)\neq 1,2$.
If $f(1)=5$ then :
$$
ff(1)=2\implies f(5)=2\\
f(3)=1\implies f(4)=4\\
ff(4)+f(5)=4+f(5)=4+2\neq 3\times 4.
$$
So $f(1)\neq 5$.
If $f(1)=3$:
$$
ff(1)=f(3)=2\\
f(3)=6-f(1)=3
$$
So again $f(1)\neq 3$.
If $f(1)=4$ then $f(3)=2$:
$$
f(f(1))=f(4)=2\\
ff(3)+f(4)=9\implies 1+f(4)=9.
$$
So $f(1)\neq 4$.
Therefore there is no function satisfying this condition.