The function $f$ maps the set of positive integers into itself, and satisfies the equation

$$
f(f(n))+f(n)=2 n+6
$$

What could this function be?
I. solution. The function $f(n)=n+2$ is suitable because its values are positive integers, and for any positive integer $n$,

$$
f(f(n))+f(n)=((n+2)+2)+(n+2)=2 n+6
$$

We will show that there is no other solution.

The function $f$ is certainly injective, that is, if $n \neq m$, then $f(n) \neq f(m)$. Indeed, if $f(n)=f(m)$, then $f(f(n))=f(f(m))$ and $2 n+6=f(f(n))+f(n)=f(f(m))=f(m)=2 m+6$, from which it follows that $n=m$. The injectivity implies that if $n \leq h$, then $f(n)=1, f(n)=2$ or $f(n) \geq h$.

Now we determine the value of $f(1)$. If we write (1) for $n=1$, we can establish an upper bound for $f(1)$:

$$
f(1)=8-f(f(1)) \leq 8-1=7
$$

To prove that $f(1)=3$, we need to exclude six cases.

Case I: $f(1)=1$. Then $f(f(1))=1$ and $f(f(1))+f(1)=2 \neq 2 \cdot 1+6$.

Case II: $f(1)=2$. Then

$f(2)=f(f(1))=2 \cdot 1+6-f(1)=6, f(6)=f(f(2))=2 \cdot 2+6-f(2)=4, f(4)=f(f(6))=2 \cdot 6+6-f(6)=14, f(14)=f(f$

This contradicts the fact that $f(14)$ is positive.

Similarly, starting with $f(1)=4,5,6$ and 7 leads to a contradiction, either a negative or a multi-valued function within at most three steps. (See the 1st Remark at the end of the problem.)

From $f(1)=3$, it follows that for every odd $n$, $f(n)=n+2$. This is true for $n=1$, as we have seen. If for some $n$, $f(n)=n+2$, then $f(n+2)=f(f(n))=2 n+6-f(n)=2 n+6-(n+2)=n+4$.

Now we determine the value of $f(2)$ as well. If we write (1) for $n=2$, we get that $f(2)=10-f(f(2)) \leq 10-1=9$. It is also certain that $f(2)$ cannot be an odd number greater than 1, because the function takes these values at odd places, which would contradict the injectivity. The possible values of $f(2)$ are therefore 4, and 1, 2, 6, and 8. Now we exclude these:

Case I: $f(2)=1$. Then $f(1)=f(f(2))=2 \cdot 2+6-f(2)=9$, which contradicts $f(1)=3$.

Similarly, we reach a contradiction for $f(2)=2,6$ and 8.

From $f(2)=4$, it again follows that for every even $n$, $f(n)=n+2$.

II. solution. That $f(n)=n+2$ is suitable can be verified according to the previous solution.

Let $n$ be any fixed positive integer. We will show that $f(n)=n+2$.

Define the following sequence: $a_{0}=n, a_{k+1}=f\left(a_{k}\right)$. The values of the function $f$ are positive integers, so this sequence consists of positive integers. Let $b_{k}=a_{k}-(n+2 k)$. By definition, $b_{0}=0$, and we want to show that $b_{1}$ is also 0.

According to equation (1),

$$
a_{k+2}+a_{k+1}=2 a_{k}+6
$$

from which

$b_{k+2}+b_{k+1}=a_{k+2}-(n+2 k+4)+a_{k+1}-(n+2 k+2)=a_{k+2}+a_{k+1}-(2 n+4 k+6)=2 a_{k}+6-(2 n+4 k+6)=2\left(a_{k}-(n\right.$

We prove by induction that for any non-negative integer $k$,

$$
b_{k}=\frac{1-(-2)^{k}}{3} b_{1}
$$

This is true for $k=0$ and $k=1$, because the equations $b_{0}=0 \cdot b_{1}=0$ and $b_{1}=b_{1}$ hold. If (3) holds for $k=m$ and $k=m+1$, then it also holds for $k=m+2$:

$$
\begin{aligned}
& b_{m+2}=2 b_{m}-b_{m+1}=2 \frac{1-(-2)^{m}}{3} b_{1}-\frac{1-(-2)^{m+1}}{3} b_{1}= \\
& \quad=\frac{2-2 \cdot(-2)^{m}-1+(-2)^{m+1}}{3} b_{1}=\frac{1-(-2)^{m+2}}{3} b_{1}
\end{aligned}
$$

This proves (3).

From the definition of the sequence $b_{k}$, $b_{k} \geq 1-n-2 k$. From this, using (3), we can obtain lower and upper estimates for $b_{1}$ by substituting some odd and even number for $k$. Let $m$ be a positive integer; substituting $k=2 m+1$ and $k=2 m$,

$$
-1-n-4 m \leq b_{2 m+1}=\frac{1+2^{2 m+1}}{3} b_{1}, 1-n-4 m \leq b_{2 m}=\frac{1+2^{2 m}}{3} b_{1}
$$

The coefficient of $b_{1}$ in the first inequality is positive, in the second it is negative. If we divide by it, the direction of the first inequality changes, but not the second. This gives us the following estimate:

$$
-\frac{3(n+4 m+1)}{1+2^{2 m+1}} \leq b_{1} \leq \frac{3(n+4 m-1)}{2^{2 m}-1}
$$

If we now let $m \rightarrow \infty$, then both the lower and upper estimates tend to 0, so $b_{1}=0$.

Based on the work of Gábor Zsolt Tóth (Budapest, Árpád Gimn., III. o.t.) and Benedek Valkó (Fazekas M. Fóv. Gyak. Gimn., IV. o.t.)

Remarks. 1. The second solution is actually a generalized version of the first. The case distinctions of the first solution were calculated simultaneously. For example, if $f(1)=x$, then based on the functional equation, we can determine that $f(x)=8-x, f(8-x)=3 x-2, f(3 x-2)=24-5 x, f(24-5 x)=11 x-22, f(11 x-22)=76-21 x$ and so on. For the last two numbers to be positive integers, it is necessary that $11 x-22 \geq 1$ and $76-21 x \geq 1$, that is, $2 \frac{1}{11} \leq x \leq 3 \frac{4}{7}$. The only integer in this interval is 3.

2. The second solution also works if the function $f$ maps the set of positive real numbers to itself. In this case, $f(x)=x+2$ is also the only solution.