Prove that an integer $a$ which satisfies the equation $a^2=1+2b^2$ for integer $b$ is of the form $a=c^2\pm1$ for some integer $c$ This question is a bit involved so thanks for your patience. After a lot of work I could show that each $b$ that satisfies this equation corresponds to another smaller integer say $s$ which satisfies the equation. here are the formulas for the solutions. $$t=s\pm\sqrt{2s^2+1}\tag{1}$$
$$x=3t\pm2\sqrt{2t^2-1}\tag{2}$$
$$y=\pm\sqrt{tx-1}\tag{3}$$
$$b=2x+y\tag{4}$$
$$a=3x+y\tag{5}$$ for nonzero $t$ and $x$. Let $x_+$ and $x_-$ denote the $x$ with the positive sign and negative sign respectively and define $y_+$ and $y_-$ similarly. Use the following rules: If you choose positive $t$ not $1$ you may  choose any one of the $x$s, but you must choose $y_+$ if you take $x_+$. If $t=1$ you may take both $x$s and with $x_+$ you must choose only $y_+$. If you take $t$ positive and choose $x_-$ you must choose $y_-$, this last solution repeats the previous solutions but it generates one the others don't when $s=2$ , $t=5$ , $x_-=1$ , $y_-=-2$ , $b=0$ , $a=1$. There are similar rules for negative $t$ but they are just the negatives of the previous solutions. I (think) I could prove that no $s$ can lead to a $b=s$ since all solutions either get smaller or larger but the absolute value always increases except for the case I singled out which leads to $b=0$, which implies that this is the complete set of solutions. I noticed that the values of $b$ increase and at some point they reach a constant ratio which is roughly $\phi=93222358/15994428$ and I used this to derive the function $$f(x)=\phi^{\left(x-11\right)}93222358$$ which is extremely accurate at first and almost exact for $x\ge7$. It gives the $x$-th nonzero value of $b$ where the zeroth value is just $0$. Here's where it gets interesting, I noticed a pattern among the $a$s, that for nonzero even $x$, $a$ can be written in the form $a=c_1^2-1$ and for odd $x$, $a=\ c_2^2+1$. I checked this until $x=15$ and it holds. Also, another reason to believe that $a$ can't be a square is that while I was trying to prove Fermat's last theorem for $n=4$ (where this equation came up), I could reduce the proof to verifying that that no such $a$ can be a square. Of course, I'm a lot more interested now than when I first encountered the equation and I want to prove this pattern.
 A: I think there is a MUCH more elementary way to solve this.
Note that $a$ must be odd. So $a=2n+1$ for some integer $n$.
Solving $(2n+1)^2 = 1+2b^2$ gives $(2n^2+2n) = b^2$ which gives $2(n+1)n$ a perfect square.
This implies that if $n$ is even, then $n+1$ must be an odd square [indeed suppose $p^e$ divides $n+1$ for some odd prime $p$ and some positive integer $e$, then as $p$ does not divide $2(n+1)$ it follows that $e$ must be even] and thus $2n$ an even square $c^2$. So here $a=c^2+1$. And if $n$ is odd then $2(n+1)$ must be an even square $c^2$. So here $a=(2n+2) -1$ which is $c^2-1$.
A: $a^2=1+2b^2$ is a Pell equation, $a^2-2b^2=1$.
The fundamental unit is $1+\sqrt2$ and it satisfies $a^2-2b^2=-1$.
Therefore, the solutions of $a^2-2b^2=1$ correspond to the powers of $(1+\sqrt2)^2=3+2\sqrt2$:
$$
a_n + b_n \sqrt2 = (1+\sqrt2)^{2n}
$$
and so are given by
$$
a_{n+1}=3a_n+4b_n
, \quad
a_0 = 1
\\
b_{n+1}=2a_n+3b_n
, \quad
b_0 = 0
$$
and also by
$$
a_{n+2}=6a_{n+1}-a_n
, \quad
a_0 = 1
, \quad
a_1 = 3
\\
b_{n+2}=6b_{n+1}-b_n
, \quad
b_0 = 0
, \quad
b_1 = 2
$$
because the minimal polynomial of $3+2\sqrt2$ is $x^2-6x+1$.
Therefore,
both ratios $a_{n+1}/a_n$ and $b_{n+1}/b_n$ converge to $3+2\sqrt2$.
Finally, we have
$$
a_n + b_n \sqrt2 = (1+\sqrt2)^{2n}
\\
a_n - b_n \sqrt2 = (1-\sqrt2)^{2n}
$$
and so
$$
2a_n = (1+\sqrt2)^{2n} + (1-\sqrt2)^{2n}
$$
Write also
$$
u_n + v_n \sqrt2 = (1+\sqrt2)^{n}
\\
u_n - v_n \sqrt2 = (1-\sqrt2)^{n}
$$
Then
$$
2u_n = (1+\sqrt2)^{n} + (1-\sqrt2)^{n}
$$
and so
$$
4u_n^2 = ((1+\sqrt2)^{n} + (1-\sqrt2)^{n})^2 = (1+\sqrt2)^{2n} + (1-\sqrt2)^{2n} + 2((1+\sqrt2)^{n}(1-\sqrt2)^{n}) \\ = 2a_n + 2(-1)^n 
$$
Since $u_n^2-2v_n^2=(-1)^n$, this gives
$$
a_n = 2u_n^2 - (-1)^n = 2(2v_n^2+(-1)^n) - (-1)^n = (2v_n)^2+(-1)^n
$$
as required. Note that we get that $c$ is even.
A: If $a^2=2b^2+1$, then
$$
(a-1)(a+1)=2b^2
$$
Note that $\gcd(a-1,a+1)\mid2$.
Since $2\mid(a-1)(a+1)$, we must have either $a\equiv1\pmod{4}$ or $a\equiv3\pmod{4}$.
If $a\equiv1\pmod{4}$, $\frac{a+1}2$ is odd and $\gcd\!\left(a-1,\frac{a+1}2\right)=1$. Thus, because
$$
(a-1)\frac{a+1}2=b^2
$$
we have that $a-1=c^2$ and $\frac{a+1}2=d^2$. Therefore, $a=c^2+1$.
If $a\equiv3\pmod{4}$, $\frac{a-1}2$ is odd and $\gcd\!\left(\frac{a-1}2,a+1\right)=1$. Thus, because
$$
\frac{a-1}2(a+1)=b^2
$$
we have that $\frac{a-1}2=d^2$ and $a+1=c^2$. Therefore, $a=c^2-1$.
