When is the sum of squares of two consecutive integers also an integer? For example: 


*

*two consecutive integers $3$ and $4$, with $\sqrt{3^2+4^2}=5$

*and for $20$ and $21$ answer the square root of $20^2+21^2$ is $29$

*for $0$ and $1$ the square root is $1$.


Any other examples?
 A: Consider the sequence $(a_n)$ given by 
$$ a_0=0, \qquad a_1=3, \qquad a_{n}=6a_{n-1}-a_{n-2}+2\text{ for }n\ge 2$$
and the sequence $(c_n)$ given by 
$$ c_0=1, \qquad c_1=5, \qquad c_{n}=6c_{n-1}-c_{n-2}\text{ for }n\ge 2.$$
Then $a_n^2+(a_n+1)^2=c_n^2$ is immediately verified for $n=0$ and $n=1$. 
Then by induction these can be expressed in terms of $\alpha=3+2\sqrt 2$ and $\beta=3-2\sqrt 2$.
More precisely, we verify that
$$ a_n = \frac{1+\sqrt 2}{4}\alpha^n+\frac{1-\sqrt 2}4\beta^n-\frac12$$
$$ c_n = \frac{2+\sqrt 2}{4}\alpha^n+\frac{2-\sqrt 2}{4}\beta^n$$
fulfill both the initial conditions and the recursion hence describe our sequencs explcitly.
Then (using $\alpha\beta=1$)
$$ a_n^2= \frac{(1+\sqrt 2)^2}{16}\alpha^{2n}+\frac{(1-\sqrt 2)^2}{16}\beta^{2n}+\frac18-\frac{1+\sqrt 2}{4}\alpha^n-\frac{1-\sqrt 2}4\beta^n$$
$$ (a_n+1)^2= \frac{(1+\sqrt 2)^2}{16}\alpha^{2n}+\frac{(1-\sqrt 2)^2}{16}\beta^{2n}+\frac18+\frac{1+\sqrt 2}{4}\alpha^n+\frac{1-\sqrt 2}4\beta^n$$
$$ c_n^2=\frac{(2+\sqrt 2)^2}{16}\alpha^{2n}+\frac{(2-\sqrt 2)^2}{16}\beta^{2n}+\frac14$$
so that by a lot of cancellation and surd simplification $c_n^2=a_n^2+(a_n+1)^2$ for all $n$.
The first few solutins thus found are $0^1+1^2=1^2$, $3^2+4^2=5^2$, $20^2+2^ 2=29^2$, $119^2+120^2=169^2$, $696^2+697^2=985^2$, $4059^2+4060^2=5741^2$, and can be continued indefinitely.
As a matter of fact, the list thus obtained is complete, i.e. there are no other solutions. But to show that would involve more than the above straightforward veififcations.
A: You are asking for the equation for generating Pythagorean triples:  $$a = x^2 - y^2 ,\ \, b = 2xy ,\ \, c = x^2 + y^2$$ for any two positive integers $x$ and $y$ with $x > y$. For consecutivity, $ x^2-y^2=2xy\pm1 $ is a requirement for the legs to have consecutive integer side lengths.
