4
$\begingroup$

I've been working in the following number theory problem: find all prime numbers $p,q,r$ such that $$p^2+q^2+r^2-1$$ is a perfect square. Does anyone has some hint for the problem? Thanks in advance.

$\endgroup$
3
  • 3
    $\begingroup$ What have you tried? What properties of square numbers do you know which might be helpful. Have you found any solutions? $\endgroup$ – Mark Bennet May 8 at 10:47
  • 2
    $\begingroup$ The triple $p=q=2$, $r=3$ is a solution. $\endgroup$ – Cl132 May 8 at 11:05
  • $\begingroup$ You have a couple of answers now, Cl. If one of them suits you, you can "accept" it by clicking in the check mark next to it. If neither one suits you, you can leave a comment explaining what more you need. $\endgroup$ – Gerry Myerson May 9 at 13:11
6
$\begingroup$

Note that if $n$ is an odd integer, then $n^2\equiv1\pmod8$, and if $n$ is an even number, then $n^2\equiv0\pmod 4$.

If $p,q,r$ are all odd primes, then $p^2+q^2+r^2-1\equiv2\pmod8$, so it can't be a square. So we may assume $p=2$, and we have $q^2+r^2+3$.

Now if $q,r$ are both odd, then $q^2+r^2+3\equiv5\pmod8$, so it's not a square. So we may assume $q=2$, and we have $r^2+7$.

If $r^2+7=m^2$, then $7=m^2-r^2$, but there is only one way to write $7$ as a difference of two squares, namely, $7=4^2-3^2$. So $r=3$, and we're done.

$\endgroup$
4
  • $\begingroup$ I held off too long posting my version of this - just to comment that $(2m+1)^2 =8\cdot \frac {m(m+1)}2$ for OP's sake (this works as a proof too) and also that working modulo $8$ is often a good thing to do when problems about squares involve parity issues. $\endgroup$ – Mark Bennet May 8 at 11:41
  • $\begingroup$ Also "only one way to write $7$" comes easily from $m^2-r^2=(m+r)(m-r)$ and $7$ is a prime so $m+r=7, m-r=1$. $\endgroup$ – Mark Bennet May 8 at 11:45
  • $\begingroup$ This question seems not to meet the standards for the site. Instead of answering it, why not look for a good duplicate target, or help the user by posting comments suggesting improvements? Please also read the meta announcement regarding quality standards. $\endgroup$ – amWhy May 9 at 15:54
  • $\begingroup$ Trivial edit made Gerry, to undownvote, as I did not dv the other answer. But please consider how you can find a way to work with the meta announcement? In particular, you are well known for your commenting skills! Anyway, Cheers. $\endgroup$ – amWhy May 9 at 21:11
1
$\begingroup$

The triple $p=q=2, r = 3$ is the only possible solution (up to reordering). To show this first reduce the expression modulo $4$. Since a square must always be congruent to $0$ or $1$ mod $4$ we get $$ p^2+q^2+r^2 \equiv 1 \pmod{4} \quad \text{or} \quad p^2+q^2+r^2 \equiv 2 \pmod{4}. $$ Since any odd number squares to $1 \pmod{4}$ we may assume $p = 2$. Hence we need to find all primes $q,r$ such that $r^2+q^2+3$ is a square. Now reduce the equation mod $3$ to find $$ r^2 + q^2 \equiv 0 \pmod{3} \quad \text{or} \quad r^2 + q^2 \equiv 1 \pmod{3}, $$ since $0$ and $1$ are the only quadratic residues modulo $3$. Therefore at least one of $q$ or $r$ must be divisible by $3$. Since we assume them to be prime this forces without loss of generality $r = 3$. Finally we look for primes $q$ such that $q^2 + 12$ is a square. The quadratic residues modulo $8$ are $0,1,4$. Reducing mod $8$ therefore gives $$ q^2 \equiv 4 \pmod{8} \quad \text{or} \quad q^2 \equiv 5 \pmod{8} \quad \text{or} \quad q^2 \equiv 0 \pmod{8}. $$ Since $5$ is a non-residue we must have $q^2 \equiv 0 \pmod{8}$ or $q^2 \equiv 4 \pmod{8}$. In either case $q$ must be even. Since we assumed it to be prime it follows $q=2$.

$\endgroup$
5
  • $\begingroup$ When you say "The only possible solution" don't forget that any one of the three primes can be the one equal to $3$ with the others equal to $3$ - three solutions as posed. $\endgroup$ – Mark Bennet May 8 at 11:26
  • $\begingroup$ I suppose that's true, I'll add an 'up to reordering' - thanks :) $\endgroup$ – Leo May 8 at 11:27
  • $\begingroup$ Two details: You have a typo ($r^2+q^3+3$), and $-1$ is not a quadratic residue modulo $8$ $\endgroup$ – jjagmath May 8 at 11:33
  • $\begingroup$ Whoops, I made the changes - thanks. $\endgroup$ – Leo May 8 at 11:36
  • $\begingroup$ This question seems not to meet the standards for the site. Instead of answering it, why not look for a good duplicate target, or help the user by posting comments suggesting improvements? Please also read the meta announcement regarding quality standards. $\endgroup$ – amWhy May 9 at 15:55

Not the answer you're looking for? Browse other questions tagged or ask your own question.