
3. Find all non-negative integers $m, n$ such that $\left|4 m^{2}-n^{n+1}\right| \leqslant 3$. (Tomáš Jurík)


Solution. If $m=0$, then the examined relation is equivalent to $n^{n+1} \leqslant 3$. This is true for $n=0$ and $n=1$, whereas for $n \geqslant 2$ we have $n^{n+1} \geqslant 8$. Thus we get two solutions $(m, n)=(0,0)$ a $(m, n)=(0,1)$.

For $m=1$ we have the inequality $\left|4-n^{n+1}\right| \leqslant 3$. We can see that $n=0$ is not a solution and $n=1$ is. For $n \geqslant 2$ we have $\left|4-n^{n+1}\right|=n^{n+1}-4 \geqslant 4$. So we get another solution $(m, n)=(1,1)$.

From now on we assume $m \geqslant 2$ and rewrite the given inequality into the form $4 m^{2}=n^{n+1}+a$, where $a$ is an (unknown) integer, whose absolute value doesn't exceed 3. We will distinguish cases when $a=0,|a| \in\{1,3\}$ and $|a|=2$.

First, assume $4 m^{2}=n^{n+1}$. The left-hand side of the equation is an even square of an integer. This must be true for the right-hand side, therefore $n$ must be positive and even; let $n=2 k$. Then $n^{n+1}=(2 k)^{2 k+1}$, and since the exponent $2 k+1$ is odd, this is a perfect square only when its base $2 k$ is be a perfect square, that is, when $2 k=r^{2}$, where $r$ is a positive integer. Clearly $r$ must be even; let $r=2 l$. Then $k=2 l^{2}$ and $n=2 k=4 l^{2}$, where $l$ is a positive integer. Since $m$ is positive, the equation $4 m^{2}=n^{n+1}$ gives

$$
m=\sqrt{\frac{n^{n+1}}{4}}=\frac{\left(\sqrt{4 l^{2}}\right)^{4 l^{2}+1}}{2}=\frac{(2 l)^{4 l^{2}+1}}{2}=l \cdot(2 l)^{4 l^{2}}
$$

In conclusion, for every positive integer $l$ we have the solution $(m, n)=\left(l(2 l)^{4 l^{2}}, 4 l^{2}\right)$.

Consider now cases $4 m^{2}=n^{n+1} \pm a$, where $a \in\{1,3\}$. From the fact that the right-hand side of the equation is even we conclude that $n^{n+1}$ is odd, which means that $n$ is odd. Since $m \geqslant 2$, we have $4 m^{2} \geqslant 16$, so we can rule out $n=-1$. Let $n=2 k+1$, where $k$ is a non-negative integer. Then we have

$$
\begin{aligned}
4 m^{2} & =n^{2 k+2} \pm a \\
\left(2 m+n^{k+1}\right)\left(2 m-n^{k+1}\right) & = \pm a
\end{aligned}
$$

Number $\pm a$ needs to be expressible as a product of two integers whose sum is equal to $\left(2 m+n^{k+1}\right)+\left(2 m-n^{k+1}\right)=4 m \geqslant 8$. At least one of them is greater than 3 , which cannot be true, because the only divisors of $\pm a$ are numbers $-3,-1,1,3$.

We're left to examine the last case $4 m^{2}=n^{n+1} \pm 2$. From this equation we can see that $n$ is not equal to 0 and is even, thus its power $n^{n+1}$ with the exponent greater than 1 is divisible by 4 , as well as $4 m^{2}$ on the left hand side. Thus the equation has no solutions.

Conclusion. All the solutions of the inequality are $(0,0),(0,1),(1,1)$ and infinitely many solutions of the form $(m, n)=\left(l(2 l)^{4 l^{2}}, 4 l^{2}\right)$, where $l$ is an arbitrary positive integer.
