Prime numbers $pFind the prime numbers $p<q<r$ such that $r^2-q^2-p^2$ is a perfect square.  
I think the only solution is (2,3,7) but i cannot prove it.
The equation would be $r^2-q^2-p^2=k^2$ equivalently
$q^2+p^2+k^2=r^2$ which is somehow a classical diophantine equation (of the pythagorean quadruples) which have a parametrization but how do i use it? The problem is from a magazine at 8 th grade and i don't think the solution is supposed to use the general solution.
Actually the general solution of $q^2+p^2+k^2=r^2$ is given by:
$ q=a^2+b^2-c^2-d^2$
$p=2(mq+np)$
$k=2(nq-mp)$
$r=a^2+b^2+c^2+d^2$
IT would follow that one of the numbers q or p is even and prime, so it is 2.

Your guess is correct: $(2,3,7)$ is the unique solution. There is a simple proof using two basic and easy to verify facts:


*

*if $m$ is odd, then $m^2\equiv 1\pmod 4$;

*if $m$ is not divisible by $3$, then $m^2\equiv 1\pmod 3$.


We proceed as follows. 
Write $r^2-p^2-q^2=k^2$ with an integer $k$.
If we had $p>2$, this would imply $p^2\equiv q^2\equiv r^2\equiv 1\pmod 4$, leading to $k^2\equiv r^2-p^2-q^2\equiv 3\pmod 4$, which contradicts the first basic fact above. Thus $p=2$, whence $r^2=q^2+k^2+4$. 
If we had $q>3$, this would imply $r^2\equiv q^2\equiv 1\pmod 3$ leading to $k^2\equiv 2\pmod 3$, which contradicts the second basic fact above. Thus $q=3$, and, as a result, $r^2=13+k^2$. Consequently, $(r-k)(r+k)=13$, which is only possible if $r-k=1$ and $r+k=13$. This yields $r=7$, $k=6$.
To summarize, the only solution is $p=2$, $q=3$, $r=7$.
