## Task 4.

Determine all pairs $(a, b)$ of natural numbers for which

$$
b\left|a^{2}+1, \quad a\right| b-2
$$
## Solution.

For $b=1$, it is necessary that $a=1$. For $b=2$, $a$ can be any odd number.

Furthermore, assume that $b \geqslant 2$.

By multiplying the conditions, we get that

$$
a b \mid a^{2} b-\left(2 a^{2}+2-b\right)
$$

Additionally, from the conditions of the problem, we have $a^{2}+1 \geqslant b$ and $b-2 \geqslant a$. Therefore,

$$
02$, which is obviously true.

For the expression $2 a^{2}+2-b$ to be divisible by $a b$, it is necessary that $2 a^{2}+2-b=a b$.

From the last equality, we have

$$
b=\frac{2 a^{2}+2}{a+1}=2 a-2+\frac{4}{a+1}
$$

from which we get the possibilities $a=1,2,4$.

By checking the initial conditions along with the solutions from the beginning, we conclude that all solutions are

$$
(a, b) \in\{(1,1),(3,5)\} \cup\{(2 k-1,2): k \in \mathbb{N}\}
$$