Subject (2). Determine the prime numbers $p>q$, knowing that

$$
p(1+3 p q)+q(1-3 p q)=p^{3}-q^{3}
$$

G.M.-B. No. 12/2014
Solution. (Official) The relation from the statement can also be written as $p+q=(p-q)^{3}$.

From here, we deduce that $p-q \mid p+q$, and since $p-q \mid p-q$, it follows that $p-q \mid 2p$. Since $p$ is a prime number, we can have 1. $p-q=1$; 2. $p-q=2$; 3. $p-q=p$; 4. $p-q=2p$.

Cases 3 and 4 are impossible. From case 1, we get $p=q+1$. Substituting into the relation $p+q=(p-q)^{3}$, we obtain $2q+1=1$, i.e., $q=0$, which is absurd.

From case 2, we get $p=q+2$. Substituting into the relation $p+q=(p-q)^{3}$, we obtain $2q+2=8$, i.e., $q=3$, and from here $p=5$.

As can be seen, it only mattered that $p$ is prime. The same procedure could have been followed if it was known only that $q$ is prime. Then we get $p-q \mid 2q$, so we can have 1. $p-q=1$; 2. $p-q=2$; 3. $p-q=q$; 4. $p-q=2q$. Cases 3 and 4 are impossible, and cases 1 and 2 are exactly as above. The condition $p>q$ is unnecessary, as it results from the given relation.

I do not like problems with overqualified (redundant) statements. A "reprocessing" could have been given, where it is only said that $p, q$ are natural numbers, and that at least one of them is prime. All the more so because the general case can be easily solved, as follows.

General Solution. Consider only the fact that $p, q$ are non-zero natural numbers (nothing about their primality). Let $d=$ gcd $(p, q), p=da$, $q=db$, for some natural numbers $a, b$ with gcd $(a, b)=1$. The relation $p+q=(p-q)^{3}$ can be written as $a+b=d^{2}(a-b)^{3}$, from which $a>b$ and $a-b \mid a+b$. Since $a-b \mid a-b$, and gcd $(a+b, a-b) \mid 2$, we have the cases

- gcd $(a+b, a-b)=1$. Then $a=b+1$ and thus $2b+1=d^{2}$, which forces $d$ to be odd, so $d=2k+1$ for some $k \in \mathbb{N}$, and $b=2k^{2}+2k$. This leads to the solutions $(p, q)=\left((2k+1)(2k^{2}+2k+1),(2k+1)(2k^{2}+2k)\right)$.
- gcd $(a+b, a-b)=2$. Then $a=b+2$ and thus $2b+2=8d^{2}$. This leads to the solutions $(p, q)=\left(d(4d^{2}+1), d(4d^{2}-1)\right)$, with $d \in \mathbb{N}^{*}$ arbitrary.

If we now want to identify the solutions where at least one of $p, q$ is a prime number, the first paragraph does not offer solutions, and the second one works only for $d=1$, when we get $(p, q)=(5,3)$.