## Task 4.

Determine all natural numbers $n$ for which there exist distinct divisors $a$ and $b$ of $n$ such that there are no other divisors of $n$ between them and that

$$
n=a^{2}-b
$$
## First solution.

Let $n, a, b$ be numbers that satisfy the conditions of the problem.

Since $a \mid n$ and $a \mid a^{2}$, it must be true that $a \mid b$, i.e., $b=m a$ for some natural number $m>1$. Since $b=m a \mid n$, we can write $n=k m a$ for some natural number $k$. From the conditions, we know that there is no divisor of $k m a$ between $a$ and $m a$.

The equation in the new variables is

$$
k m a=a^{2}-m a
$$

from which it follows that $a=(k+1) m$, so $n=k(k+1) m^{2}$.

From the fact that $a$ and $b$ are consecutive divisors, it follows that there is no divisor of $k(k+1) m^{2}$ between $(k+1) m$ and $(k+1) m^{2}$. This means that the divisor $k m^{2}$ is either less than or equal to $(k+1) m$ or greater than or equal to $(k+1) m^{2}$. The second option is obviously impossible, so we conclude

$$
k m^{2} \leqslant(k+1) m
$$

which means $k m \leqslant k+1$. But $k m \geqslant 2 k$, so $2 k \leqslant k+1$, and thus $k=1$ and $m^{2} \leqslant 2 m$, i.e., $m=2$. It follows that $n=1 \cdot(1+1) \cdot 2^{2}=8, a=4$ and $b=8$. Clearly, 4 and 8 are consecutive divisors of 8, so we conclude that $n=8$ is the only solution.