Find prime numbers with given property 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.

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$.
