<s>[INST] Integral solutions of $x^2+y^2+1=z^2$ I am interested in integral solutions of $$x^2+y^2+1=z^2.$$ Is there a complete theory comparable to the one for $x^2+y^2=z^2?$
 [/INST] the equation:  $X^2+Y^2=Z^2-1$  
Solutions can be written using the solutions of Pell's equation: $p^2-2k(k-1)s^2=1$  
$k$ - given by us. 
Solutions have form: 
$X=2kps-2(k-1)s^2$ 
$Y=2(k-1)ps+2ks^2$  
$Z=p^2+2(k^2-k+1)s^2$ 
And more: 
$X=2p^2-2(3k-2)ps+2(2k-1)(k-1)s^2$  
$Y=2p^2-2(3k-1)ps+2k(2k-1)s^2$ 
$Z=3p^2-4(2k-1)ps+2(3k^2-3k+1)s^2$
Although it should be a more general solution to record.
</s>