<s>[INST] Find a general method to find particular solutions where the sum of the squares of two consecutive integers is equal to the square of another integer Question:  If the sum  of the squares of two consecutive integers is equal to the square of another integer, then find a general method to find particular solutions.  E.g., $27304196^2+27304197^2=38613965^2$.
I tried to figure out other solutions such as $3^2+4^2=5^2$ and $20^2+21^2=29^2$, but I don't know how to find a method for general solutions.
Can anybody help me
 [/INST] For $A^2+B^2=C^2:\space B=A\pm1\quad$ the $C$-values are the odd Pell numbers  $(5,29,169,985\cdots)$ as shown in A000129
and the triples $T_n$ that contain them can be generate sequentially by the formula below with a seed of $\quad T_0=(0,0,1)$
$$A_{n+1}=3A_n+2C_n+1\qquad B_{n+1}=3A_n+2C_n+2\qquad C_{n+1}=4A_n+3C_n+2$$
For example, it generates the following
$$T_1=(3,4,5)\quad T_2=(20,21,29)\quad T_3=(119,120,169)\quad T_4=(697,696,985)$$
They may also be generated directly using Euclid's formula
$$\text{where} \qquad A=m^2-k^2 \qquad B=2mk \qquad C=m^2+k^2\quad \text{and}$$
\begin{equation}
 m_n= \frac{(1 + \sqrt{2})^{n+1} - (1 - \sqrt{2})^{n+1}}{2\sqrt{2}}\qquad \qquad\qquad
 k_n= \frac{(1 + \sqrt{2})^n - (1 - \sqrt{2})^n}{2\sqrt{2}}
 \end{equation}
For example
\begin{align*}
 \frac{(1 + \sqrt{2})^{2} - (1 - \sqrt{2})^{2}}{2\sqrt{2}}=2 \qquad & 
     \frac{(1 + \sqrt{2})^1 - (1 - \sqrt{2})^1}{2\sqrt{2}}=1 \\ 
&\qquad\qquad   F(2,1)=(3,4,5)\\    
 \frac{(1 + \sqrt{2})^{3} - (1 - \sqrt{2})^{3}}{2\sqrt{2}}=5 \qquad &
     \frac{(1 + \sqrt{2})^2 - (1 - \sqrt{2})^2}{2\sqrt{2}}=2 \\
& \qquad\qquad  F(5,2)=(21,20,29)\\
  \frac{(1 + \sqrt{2})^{4} - (1 - \sqrt{2})^{4}}{2\sqrt{2}}=12 \qquad & 
      \frac{(1 + \sqrt{2})^3 - (1 - \sqrt{2})^3}{2\sqrt{2}}=5 \\ 
&\qquad\qquad  F(12,5)=(119,120,169)\\ 
 \frac{(1 + \sqrt{2})^{5} - (1 - \sqrt{2})^{5}}{2\sqrt{2}}=29 \qquad &
     \frac{(1 + \sqrt{2})^4 - (1 - \sqrt{2})^4}{2\sqrt{2}}=12 \\ 
&\qquad\qquad  F(29,12)=(697,696,985)
 \end{align*}
</s>