When The Sum Of Squares Of Two Consecutive Integers Is Again A Perfect Square? Find all positive integers $n < 200$, such that $n^2 + (n + 1)^2$ is a perfect square.
Well setting this equal to $k^2$ is important. But before that, since all squares $\equiv 0$ or $1$ (mod $3$ $,4)$ so using this we get that one of the two numbers is divisible by $3$ and same for $4$ (one of the two is divisible by $4$). This gives us cases, like if $4,3 |n$ or $4|n$ and $3|n+1$ and so on. however this seems very tedious, and anyway, for example, the first case, I still don't get how I would solve $(12k)^2+(12k+1)^2=m^2$ for $k,m \in \mathbb N$. Help please; I'm stuck.
 A: Say $n^2+(n+1)^2=k^2$.  That is, $2n^2+2n+(1-k^2)=0$.
Solving this quadratic equation yields $n=\dfrac{-1+\sqrt{2k^2-1}}2$.
So $2k^2-1=m^2$ or $m^2-2k^2=-1$.
That is a Pell-type equation, and solutions are known to be $k=5, 29, 169, 985, ... .$
Can you take it from here?
A: 
Not a 'real' answer, but it was too big for a comment.

I wrote and ran some Mathematica code:
In[1]:=k = 200;
ParallelTable[
 If[IntegerQ[FullSimplify[Sqrt[n^2 + (n + 1)^2]]], n, Nothing], {n, 1,
   k}]

Running the code gives:
Out[1]={3, 20, 119}


If we, for example, want to extend the search to $10^5$ the number of solutions is given by:
In[2]:=k = 10^5;
Length[ParallelTable[
  If[IntegerQ[FullSimplify[Sqrt[n^2 + (n + 1)^2]]], n, Nothing], {n, 
   1, k}]]

Out[2]=6

In[3]:=k = 10^5;
ParallelTable[
 If[IntegerQ[FullSimplify[Sqrt[n^2 + (n + 1)^2]]], n, Nothing], {n, 1,
   k}]

Out[3]={3, 20, 119, 696, 4059, 23660}

So for $1\le\text{k}\le10^5$ we know that we have $6$ solutions to the question when $\sqrt{\text{n}^2+\left(\text{n}+1\right)^2}\in\mathbb{N}$.
A: We can directly reach the negative pell equation as below:
$$n^2+(n+1)^2=2n^2+2n+1=k^2\\\implies 4n^2+4n+2=2k^2\\\implies(2n+1)^2-2k^2=-1$$
So the problem is equivalent to find solutions to the negative Pell's equation $$x^2-2y^2=-1\tag{1}$$ with $x$ odd. We observe that $(1,1)$ is a solution $(1)$ and is a fundamental solution as it minimizes the quantity $x+y\sqrt{2}$. It's well known (for reference you can wave the pages of An Introduction to Diophantine Equations by Titu Andreescu) that all solutions $(x_n,y_n)$ to $(1)$ are given by $$x_n+y_n\sqrt{2}=(1+\sqrt{2})^{2n-1}\;(n\in\mathbb{N})\tag{2}$$ You can easily verify that $x_n$ is always odd. So these give all solutions to your problem.
Remark: Relation $(2)$ makes sense as $x_n-y_n\sqrt{2}=(1-\sqrt{2})^{2n-1}$. Therefore $x_n^2-2y_n^2=(x_n+y_n\sqrt{2})(x_n-y_n\sqrt{2})=(1+\sqrt{2})^{2n-1}(1-\sqrt{2})^{2n-1}=(1-2)^{2n-1}=(-1)^{2n-1}=-1$
A: If we let $m=n+\sqrt{2n^2+(-1)^n}$, starting with $1$, we get a pair of pell numbers that feed directly into Euclid's formula for generating Pythagorean triples which are the ordered pairs (A,B,C) where $A^2+B^2=C^2$.
$$F(m,n):\qquad A=m^2-n^2\qquad B=2mn\qquad C=M^2+n^2$$
Examples:
$$n=1\implies m=1+\sqrt{2+(-1)^1}=1+1=2\quad F(2,1)=(3,4,5)$$
$$n=2\implies m=2+\sqrt{8+(-1)^2}=2+3=5\quad F(5,2)=(21,20,29)$$
$$n=5\implies m=5+\sqrt{50+(-1)^5}=5+7=12\quad F(12,5)=(119,120,169)$$
There an an infinite number of these but if you don't like the alternate $(A<B)$ vs $(A>B)$ you can use this formula, starting with a nonworking $seed$ of $(A_0,B_0,C_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\qquad$$
This produces the triples $\quad(3,4,5)\quad (20,21,29)\quad (119,120,169)\quad ...$
These three are the only triples where $(A,B,C)<200$
