In If $p,q$ are prime, solve $p^3-q^5=(p+q)^2$., the author asks to solve the equation $p^3-q^5=(p+q)^2$ for primes $p$ and $q$. A proof is given that $p=7, q=3$ is the only solution.
In this "followup", I would like to ask for a proof that does not depend on $p$ and $q$ being primes but allows arbitrary positive integers.
I do have an elementary proof for the case in which $p$ and $q$ are relatively prime, but the case in which they aren't is giving me a hard time. Anyone here who can help?
9/12 update: As I commented, I may have been wrong when I claimed I had a proof for the case where $p$ and $q$ are relatively prime, but it should be possible to prove with the additional condition $(p,q+1)=1$ (not $q-1$ as I had written in the comment). Here's the proof:
Assume that $p$ and $q$ are positive integers such that $$p^3-q^5=(p+q)^2\text{,}\tag{1} $$ $$(p,q)=1,\tag{2}$$ $$(p,q+1)=1.\tag{3}$$ Note that (1) implies that $$q<p.\tag{4}$$ Evaluating (1) modulo $q$ gives $p^3\equiv p^2\pmod{q}$, so by (2), $p\equiv1\pmod{q}$, i.e. there exists $a\in\mathbb{N}$ such that $$p=aq+1.\tag{5}$$ Likewise, if we evaluate (1) modulo $p$, we get $-q^5\equiv q^2\pmod{p}$, so $p$ divides $q^5+q^2=q^2(q+1)(q^2-q+1)$ and thus by (2) and (3), $$p\;|\;q^2-q+1.\tag{6}$$ Combining (5) and (6), we get that $p$ divides $q^2-q+1-aq-1=q(q-a-1)$ and therefore by (2), $$p\;|\;q-a-1\tag{7}.$$ Note that, since the right-hand side in (6) is positive, $q-a-1$ must not be negative. On the other hand, (4) implies that it cannot be positive either, so it is $0$ and we have $a=q-1$ and therefore $$p=q^2-q+1.\tag{8}$$ Now, substituting (8) in (1) and evaluating modulo $q^2$ gives $-3q+1\equiv1\pmod{q^2}$, i.e. $q^2$ divides $3q$ which forces $q=3$ and $p=7$.