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