Problem 8.2. Determine all pairs of natural numbers $n$ and $m$, for which the numbers $n^{2}+4 m$ and $m^{2}+5 n$ are squares.

Answer: $(m, n)=(2,1),(22,9),(9,8)$.
Solution. Let's consider two cases. First, assume that $m \leqslant n$. Then $n^{2}+4 m \leqslant$ $n^{2}+4 n<(n+2)^{2}$. Therefore, $n^{2}+4 m=(n+1)^{2}$, from which $4 m=2 n+1$, which is impossible due to parity considerations.

Now assume that $n<m$. Then $m^{2}+5 n<m^{2}+6 m<(m+3)^{2}$, from which either $5 n=2 m+1$ or $5 n=4 m+4$. We will examine each of these subcases separately.

If $5 n=2 m+1$, then $4 m=10 n-2$ and the number $n^{2}+10 n-2$ is a square. This is the square of a number greater than $n$ and less than $n+5$, of the same parity as $n$. Therefore, either $n^{2}+10 n-2=n^{2}+4 n+4$, or $n^{2}+10 n-2=n^{2}+8 n+16$. In the end, either $n=1$ and $m=2$, or $n=9$ and $m=22$.

If $5 n=4 m+4$, then $4 m=5 n-4$ and the number $n^{2}+5 n-4$ is a square. This is the square of a number greater than $n$ and less than $n+3$. Therefore, either $n^{2}+5 n-4=n^{2}+2 n+1$, or $n^{2}+5 n-4=n^{2}+4 n+4$. The first equation has a non-integer root, while the second gives $n=8$, from which $m=9$.

All the obtained solutions are valid.

## Criteria

Any correct solution to the problem is worth 7 points. In the absence of such a solution, the following criteria are summed:

## 2 6. There is a complete correct answer.

If there is no correct answer, but at least one of the solutions is found, then 1 point is given instead of 2.

3 6. The case $m \leqslant n$ is correctly considered.

3 6. The case $n \leqslant m$ is correctly considered.

2 6. Neither of the above two cases is correctly considered, but there is an idea to estimate the expression as a perfect square (for example, $m^{2}+5 n<(m+3)^{2}$ or $n^{2}+4 m<$ $\left.(n+2)^{2}\right)$