TITLE: If $p,q$ are prime, solve $p^3-q^5=(p+q)^2$.
QUESTION [8 upvotes]: If $p,q$ are prime, solve $$p^3-q^5=(p+q)^2$$
I can't think of a nice idea for the solution. Since there's a solution $(7;3)$, consisting of two distinct numbers, I really doubt modular arithmetic would help here in any way. I wonder if there's an interesting and simple approach. Thanks.

REPLY [12 votes]: Let's check all the possibilities of $p,q\mod 3$.

If $p\equiv1\mod3$ and $q\equiv1\mod3$ then $p^3-q^5\equiv0\mod3$
and $(p+q)^2\equiv1\mod3$. No solution exists.
If $p\equiv-1\mod3$ and $q\equiv-1\mod3$ then $p^3-q^5\equiv0\mod3$
and $(p+q)^2\equiv1\mod3$. No solution exists.
If $p\equiv1\mod3$ and $q\equiv-1\mod3$ then $p^3-q^5\equiv2\mod3$
and $(p+q)^2\equiv0\mod3$. No solution exists.
If $p\equiv-1\mod3$ and $q\equiv1\mod3$ then $p^3-q^5\equiv1\mod3$
and $(p+q)^2\equiv0\mod3$. No solution exists.

If there is a solution we must have either $p=3$ or $q=3$. It is clear that we cannot have $p=3$. So the only possible solutions are with $q=3$, leading to the equation
$$
p^3=3^5+(p+3)^2.
$$
It is easy to see that $p=7$ is the only solution.