## Task A-2.4.

Determine all pairs $(m, n)$ of integers for which $m^{2}=n^{5}+n^{4}+1$, and the number $m-7n$ divides $m-4n$.
## First Solution.

Notice that $n^{5}+n^{4}+1=\left(n^{3}-n+1\right)\left(n^{2}+n+1\right)$, so we have

$$
m^{2}=\left(n^{3}-n+1\right)\left(n^{2}+n+1\right)
$$

Let's calculate the greatest common divisor of the expressions in parentheses:

$$
\begin{aligned}
M\left(n^{3}-n+1, n^{2}+n+1\right) & =M\left(n^{3}-n+1-n\left(n^{2}+n+1\right), n^{2}+n+1\right) \\
& =M\left(-n^{2}-2 n+1, n^{2}+n+1\right) \\
& =M\left(-n^{2}-2 n+1+\left(n^{2}+n+1\right), n^{2}+n+1\right) \\
& =M\left(-n+2, n^{2}+n+1\right) \\
& =M\left(-n+2, n^{2}+n+1+n(-n+2)\right) \\
& =M(-n+2,3 n+1) \\
& =M(-n+2,3 n+1+3(-n+2)) \\
& =M(-n+2,7)
\end{aligned}
$$

We conclude that the greatest common divisor $d$ of the numbers $n^{3}-n+1$ and $n^{2}+n+1$ is 1 or 7, so we have two cases.

If $d=7$, then from the equality $m^{2}=\left(n^{3}-n+1\right)\left(n^{2}+n+1\right)$ it follows that $m$ is divisible by 7. Furthermore, from $d=M(-n+2,7)$, we see that $d=7$ only if $n$ gives a remainder of 2 when divided by 7. Thus, $n$ is not divisible by 7. According to the condition of the problem,

$$
\frac{m-4 n}{m-7 n}=1+\frac{3 n}{m-7 n}
$$

must be an integer. We conclude that $m-7 n$ divides $3 n$, but this is impossible because $m-7 n$ is divisible by 7, while $3 n$ is not. Therefore, there are no solutions in the case $d=7$.

If $d=1$, then the equality $m^{2}=\left(n^{3}-n+1\right)\left(n^{2}+n+1\right)$ gives a factorization of the perfect square $m^{2}$ into relatively prime factors $n^{3}-n+1$ and $n^{2}+n+1$. Since the factors are relatively prime, each of them must be a square of an integer.

In particular, $n^{2}+n+1$ is a square of an integer. This is obviously true for $n=-1,0$. Let's show that for the remaining integers $n$ this is not the case. Indeed, for all natural numbers $n$ the inequalities

$$
n^{2}<n^{2}+n+1<(n+1)^{2}
$$

hold. Analogous conclusions are obtained for $n<-1$ using the inequalities $(n+1)^{2}<n^{2}+n+1<n^{2}$ which hold for all integers $n<-1$.

Thus, we have shown that the only possibilities are $n=-1$ and $n=0$. For $n=-1$ from the initial condition we get $m^{2}=-1$, so we discard this case. For $n=0$ we get $m^{2}=1$, that is, $m=-1$ or $m=1$.

For $n=0$ and $m \neq 0$ we see that $m-7 n$ divides $m-4 n$, so the final solutions are the pairs

$$
(m, n)=(-1,0), \quad \text{and} \quad(m, n)=(1,0)
$$