## Task A-4.5.

Determine all functions $f: \mathbb{N} \rightarrow \mathbb{N}$ such that for all $a, b \in \mathbb{N}$ for which $f(a) \neq b$, the following holds:

$$
f(a)-b \mid f(a)^{2}+2 b+1-f(b)^{2}
$$
## First Solution.

If we subtract $(f(a)-b)(f(a)+b)$ from the right side, we obtain a condition equivalent to the original:

$$
f(a)-b \mid (b+1)^{2}-f(b)^{2}
$$

From the obtained condition, we directly see that the function defined by the rule $f(n)=n+1$ for all $n \in \mathbb{N}$ satisfies the condition of the problem. Now assume that there exists another function $f: \mathbb{N} \rightarrow \mathbb{N}$ that satisfies the above condition.

Consider some fixed $b \in \mathbb{N}$ such that $f(b) \neq b+1$. For every $a \in \mathbb{N}$, we then have $f(a)=b$ or $f(a)-b \mid (b+1)^{2}-f(b)^{2}$, from which it follows that for all $a \in \mathbb{N}$

$$
f(a) \leqslant b+\left|(b+1)^{2}-f(b)^{2}\right|
$$

Since $b$ is fixed, we conclude that the function $f$ is bounded from above.

Since the function is bounded, infinitely many values of the domain achieve only finitely many values of the codomain, so there exists a value $y \in \mathbb{N}$ in the codomain that is achieved for infinitely many $x \in \mathbb{N}$ in the domain. Substituting $a=b=x$ into the initial condition (there are infinitely many such $x$ different from $f(x)=y$), we get that the number

$$
\frac{f(x)^{2}+2 x+1-f(x)^{2}}{f(x)-x}=\frac{2 x+1}{y-x}=\frac{2 x+1-2 y+2 y}{y-x}=2+\frac{2 y+1}{y-x}
$$

is an integer for a fixed $y$ and infinitely many $x$. However, the number $2 y+1$ is different from zero and has only finitely many divisors, which leads to a contradiction.

The function defined by the rule $f(n)=n+1$ for all $n \in \mathbb{N}$ is the only function that satisfies the conditions of the problem.