$p^2+1=q^2+r^2$. Strange phenomenon of primes Problem:
Find prime solutions to the equation
$p^2+1=q^2+r^2$
I welcome you to post your own solutions as well
I have found a strange solution which I can't understand why it works(or what's the math behind it.) Here it is through examples
Put $r=17$(prime)
Now $17^2-1=16\times 18=288=2 \times 144$ (a particular factorization)
$\frac {2+144}{2}=73$
$\frac {144-2}{2}=71$
Solution pair $(p,q,r)=(73,71,17)$
Put $r=23$, 
$23^2-1=22\times 24=8\times 66$
$\frac {8+66}{2}=37$
$\frac {66-8}{2}=29$
Solution pair $(37,29,23)$
It works for each prime except for $2,3,5$ Which generate 
$(2,2,1),(3,3,1),5,5,1)$
Please explain me how it's working 

Let $r=193$, a prime. Then $$r^2-1=9313^2-9311^2=3107^2-3101^2=323^2-259^2$$ are the only expressions of $r^2-1$ as a difference of two squares, but $9313=67\times139$, and $3101$ and $259$ are both multiples of $7$. Thus, $p^2+1=q^2+r^2$ is impossible in primes $p,q$ for this prime value of $r$. 
