Is this divisibility problem correct? Let $n$ be a natural number and let $1 \le a_1<a_2<...<(a_k=n)$ be all of its divisors.
Find all $n$ such that $a_2^3+a_3^2-15=n$ .
It seems impossible to find all such numbers.
 A: We must have $a_2 = p$, where $p$ is the smallest prime dividing $n$. Then $a_3$ must be either the next smallest prime $q$ dividing $n$, or $p^2$. But if we had $a_3 = p^2$, then from $p^2 | n$ we would obtain $p^2 | 15$, which is absurd. Therefore $a_3 = q$, and moreover $p < q$.
Thus we obtain $p^3 + q^2 - 15 = n = cpq$ for some integer $c$. The number $c$ is a divisor of $n$, hence either $c = 1$, $c = p$, or $c \geq q$. 
If $c = 1$, then from $pq < q^2$, we deduce $p^3 < 15$, hence $p = 2$. In this case, $q$ must satisfy $q^2 - 2q - 7 = 0$, which is absurd.
Now assume $c \geq q$. Then we must also have $q \geq p + 2$ (since the only alternative is $p=2$, $q = 3$, and this is trivially impossible). Then
$$p^3 - 15 = cpq - q^2 \geq q^2(p-1) \geq (p + 2)^2(p-1),$$
and this inequality in $p$ has no solutions. Thus we conclude that $c = p$, hence
$$f(q) = q^2 - p^2q + p^3 - 15 = 0.$$
It is straightforward to check that the cases $p = 2,3$ are impossible, so we have $p > 3$.
The quadratic function $f(q)$ has its minimum at $q = p^2/2$, a half-integer. Moreover $f(p) = p^2 - 15 > 0$ and $f(p + 2) = -p^2 + 4p - 11 < 0$. Therefore $f(q)$ has a root between $p$ and $p + 2$ and another (symmetric) one strictly between $p^2 - p - 2$ and $p^2 - p$. Thus the only possibilities for $q$ are $q = p + 1$ and $q = p^2 - p - 1$, and we must have $2p - 14 = f(p + 1) = 0$, hence $p = 7$. Then either $q = 8$, which is absurd, or $q = 41$. Thus the only possibility is $n = p^2 q = 7^2 \cdot 41 = 2009$.
Conversely, it is clear that $n = 2009$ works.
A: There are two posibilities for $a_2$ and $a_3$:
$$
a_2=p,\ a_3=p^2\quad\text{or}\quad a_2=p,\ a_3=q
$$
where $p$ and $q$ are prime divisors of $n$ and $p<q<p^2$.
Note: the restriction $q<p^2$ is not necessary. See barak manos comment below.
For the first one we have $p^3+p^4-15=n$. Since $p^2\mid n$ this implies that $p^2\mid15$, which is not possible.
For the second one we get $p^3+q^2-15=n$. Since $q\mid n$ it must be hat $q\mid p^3-15$ (and remenber that $p<q$.) Let's see the possible values of $p$.


*

*$p=2$. Then $q\mid7$ which is not possible.

*$p=3$. Then $q\mid12$ which is not possible.

*$p=5$. Then $q\mid110=2\cdot5\cdot11$, which again is not possible.

*$p=7$. Then $q\mid328=2^3\cdot41$, $q=41$ and $n=7^3+41^2-15=2009=7^2\cdot41$ is a solution.

*$p>7$. For a proof see user298259's answer.

