## Task 4.

Find all natural numbers $a$ and $b$ such that

$$
\left(a^{2}+b\right) \mid\left(a^{2} b+a\right) \quad \text { and } \quad\left(b^{2}-a\right) \mid\left(a b^{2}+b\right)
$$
## Solution.

From the fact that $\left(a^{2}+b\right) \mid\left(a^{2} b+a\right)$, we conclude that

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

is an integer.

Therefore, we conclude that $a^{2}+b \leqslant b^{2}-a$ or $b^{2}-a \leqslant 0$. In the second case, it would follow that $a<a^{2}+b \leqslant a-b^{2}<a$, which is obviously impossible. Thus, $a^{2}+b \leqslant b^{2}-a$.

Similarly, from the fact that $\left(b^{2}-a\right) \mid\left(a b^{2}+b\right)$, we conclude that this must also be an integer:

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

From this, it follows that $b^{2}-a \leqslant a^{2}+b$, so $b^{2}-a=a^{2}+b$. The previous equation can be written as $(b+a)(b-a)=a+b$, from which dividing by $a+b$ we get that $b=a+1$. Direct substitution easily verifies that all numbers of this form satisfy the conditions of the problem. Therefore, all solutions are $(n, n+1)$ for $n \in \mathbb{N}$.

## CROATIAN MATHEMATICAL OLYMPIAD

## Second day

Zagreb, April 14, 2013.