If $2n+1$ and $3n+1$ are perfect squares, then prove that $8|n$.

diophantine equationsdiscrete mathematicsdivisibilitymodular arithmeticpell-type-equations

If for some number $n\in \mathbb N$, the numbers $2n+1$ and $3n+1$ are perfect squares of integers, then prove that $8|n$.

if $2n+1=m^2$ and $3n+1=k^2$ then $k^2-m^2=3n-2n+1-1=n$ now I need to show that $8|k^2-m^2$ when you divide a some number $m^2$ with $8$ then remainder is $0,1,4$, so I need to show that $m^2$ and $k^2$ have the same remainder. But I do not know is this good way because I do not know how to prove that they must have the same remainder

Best Answer

If $2n+1=a^2$ and $3n+1=b^2$, then $a$ is odd. So $a=2k+1$ and $2n+1=(2k+1)^2=4k^2+4k+1$. Thus, $n=2k^2+2k=2k(k+1)$. This shows that $n$ is divisible by $4$ because $k(k+1)$ is even.

Now, $b^2=3n+1=6k(k+1)+1$. So, $b$ is also odd and $b=2l+1$. Then, $(2l+1)^2=6k(k+1)+1$ implies $2l(l+1)=3k(k+1)$. That is $k(k+1)$ is divisible by $4$ because $l(l+1)$ is even. Because $n=2k(k+1)$ and $k(k+1)$ is divisible by $4$, $n$ is divisible by $8$.


In fact, $3a^2-2b^2=3(2n+1)-2(3n+1)=1$. That is, $$(1+\sqrt{-2})(1-\sqrt{-2})a^2=1+2b^2=(1+\sqrt{-2}b)(1-\sqrt{-2}b).$$ Note that $\Bbb{Q}(\sqrt{-2})$ is a quadratic field with class number $1$, it is a ufd and we can talk about gcd. Because $\gcd(1+\sqrt{-2}b,1-\sqrt{-2}b)=1$, we get that either $$\frac{1+\sqrt{-2}b}{1+\sqrt{-2}}=(u+\sqrt{-2}v)^2$$ or $$\frac{1-\sqrt{-2}b}{1+\sqrt{-2}}=(u+\sqrt{-2}v)^2$$ for some $u,v\in\Bbb{Z}$. But up to sign switching $b\to -b$, we can assume that $$\frac{1+\sqrt{-2}b}{1+\sqrt{-2}}=(u+\sqrt{-2}v)^2=u^2-2v^2+2uv\sqrt{-2}.$$ That is, $$1+\sqrt{-2}b=u^2-2v^2-4uv+(u^2-2v^2+2uv)\sqrt{-2}.$$ So, $u^2-2v^2-4uv=1$ and so $(u-2v)^2-6v^2=1$. So, $(x,y)=(u-2v,v)$ is a solution to the Pell-type equation $$x^2-6y^2=1.$$ The solutions are known $$x+\sqrt{6}y=\pm(5+2\sqrt{6})^t$$ where $t\in\Bbb{Z}$. Since the sign switching $(u,v)\to(-u,-v)$ does not change anything, we can assume that $$u-2v+\sqrt{6}v=(5+2\sqrt{6})^t.$$ So, $$u-2v=\frac{(5+2\sqrt{6})^t+(5-2\sqrt{6})^{t}}{2}$$ and $$v=\frac{(5+2\sqrt{6})^t-(5-2\sqrt{6})^{t}}{2\sqrt{6}}.$$ That is, $$u=\frac{(2+\sqrt{6})(5+2\sqrt{6})^t-(2-\sqrt{6})(5-2\sqrt{6})^{t}}{2\sqrt{6}}.$$ That is, $$b=u^2-2v^2+2uv=\frac{(2+\sqrt{6})(5+2\sqrt{6})^{2t}+(2-\sqrt{6})(5-2\sqrt{6})^{2t}}{4}.$$ This gives $$a=\sqrt{\frac{1+2b^2}{3}}=u^2+2v^2=\frac{(3+\sqrt{6})(5+2\sqrt{6})^{2t}+(3-\sqrt{6})(5-2\sqrt{6})^{2t}}{6}.$$ So, we have $$n=\frac{(5+2\sqrt{6})^{4t+1}-10+(5-2\sqrt{6})^{4t+1}}{24},$$ where $t\in\mathbb{Z}$. So the first seven values of $n$ are $$n=0,40,3960, 388080,38027920,3726348120,365144087880.$$ That is, $n=n(t)$ satisfies $n(0)=0$ and $n(-1)=40$ with $$n(t-1)+n(t+1)=9602 n(t)+4000$$ for all $t\in\mathbb{Z}$. So, not only $8$ divides $n$, $40$ divides $n$ for every such $n$.


I think it is easier to re-parametrize $n$ using non-negative integers instead of all integers. Let $$n_t=\frac{(5+2\sqrt{6})^{2t+1}-10+(5-2\sqrt{6})^{2t+1}}{24},$$ for non-negative integer $t$. So, $n_0=0$, $n_1=40$, and $$n_{t+2}=98n_{t+1}-n_t+40.$$ We have the corresponding $a=a_t$ and $b=b_t$ to $n=n_t$: $a_0=1$, $a_1=9$, and $$a_{t+2}=10a_{t+1}-a_t,$$ as well as $b_0=1$, $b_1=11$, and $$b_{t+2}=10b_{t+1}-b_t.$$

$$ \begin{array}{ |c|c|c|c| } \hline t & n_t & a_t & b_t \\ \hline 0 & 0 & 1 &1 \\ 1 & 40 & 9& 11 \\ 2 & 3960 & 89 & 109 \\ 3 & 388080 & 881 &1079\\ 4 & 38027920 & 8721 & 10681 \\ 5 & 3726348120 & 86329 & 105731 \\ 6 & 365144087880 & 854569 & 1046629 \\\hline \end{array} $$