Unique pair of positive integers $(p,n)$ satisfying $p^3-p=n^7-n^3$ where $p$ is prime

Q. Find all pairs $(p,n)$ of positive integers where $p$ is prime and $p^3-p=n^7-n^3$.

Rewriting the given equation as $p(p+1)(p-1)=n^3(n^2+1)(n+1)(n-1)$, we see that $p$ must divide one of the factors $n,n+1,n-1,n^2+1$ on the $\text{r.h.s}$.

Now, the $\text{l.h.s}$ is an increasing function of $p$ for $p\ge1$. This implies that for any given $n\ge1$, there is exactly one real $p$ for which $\text{l.h.s}=\text{r.h.s}$. For $p=n^2$, we get $\text{l.h.s}=n^6-n^2<n^7-n^3=\text{r.h.s}.$ This means that either $p>n^2$ or $p<n^2$ must hold.

Assuming $p>n^2$, it follows that the prime $p$ cannot divide any of $n,n+1,n-1$. So $p$ must divide $n^2+1$ and hence $p=n^2+1\quad (\because p>n^2)$.

Substituting the value of $p$ in the given equation we get, $n^2+2=n^3-n\implies n^3-n^2-n=2$. As the factor $n$ on the $\text{l.h.s}$ must divide $2$, the above equation has a unique integer solution $n=2$.

Finally, we get $(5,2)$ as the solution to the given equation.

But how do I conclude this is the only solution possible? Also, why does'nt $p<n^2$ (the case which I ignored) hold? As a bonus question, I would like to ask for any alternative/elegant solution (possibly using congruence relations) to the problem.


Solution 1:

We have $$p(p+1)(p-1)=n^3(n^2+1)(n+1)(n-1)$$ so, clearly, $n=1$ and $n\ge p$ are discarded hence one has $1\lt n\lt p$ and $(n,p)=1$ and $p$ neither divides $n^3$ nor $n-1$. Besides the possibility $p=n+1$ is easily discarded.

It follows $p$ divides $n^2+1$ and since $n^2+1$ neither divides $p-1$ nor $p+1$ then we get $$p=n^2+1$$ which gives immediately the solution $(p,n)=(5,2)$.

That this solution is the only one is deduced putting the value of $p$ in the given equality so we have

$$n^2(n^2+1)(n^2+2)=n^7-n^3\iff n^5-n^4-3n^3-n-2=0$$ this last equation has as only real root $n=2$ (the other roots are $\pm i$ and $\pm \sqrt[3]{-1}$).

Thus $(p,n)=(5,2)$ is the only solution.

Solution 2:

To eliminate the case $p\lt n^2$, note that $p\lt n^2$ implies $p+1\lt n^2+1$ and $p-1\lt n^2-1$, and this gives $p^3-p=p(p+1)(p-1)\lt n^2(n^2+1)(n^2-1)\le n^3(n^2+1)(n^2-1)=n^7-n^3$.

Remark: The paragraph that argues that either $p\gt n^2$ or $p\lt n^2$ isn't really necessary. It's obvious that $p\not=n^2$, since primes cannot be squares.