If $2n+1$ and $3n+1$ are perfect squares, then prove that $8|n$. 
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

It's a standard exercise that if $b > a$ and $a$ and $b$ are both odd that
i) $a + b$ and $a-b$ are both even and that
ii) exactly one of $a+b$ and $a-b$ is divisible by $4$.

Pf: Let $b = 2m + 1$ and $a = 2n+1$ so $b-a = 2(m-n)$ and $b+a = 2(m+n+1)$ are both even.
If $m$ and $n$ are both even or both odd then $m-n$ is even and $m+n + 1$ is odd so $4|b-a$ but $4\not \mid b+a$.  If $m$ and $n$ are opposite paritty then the exact opposite occurs; $m-n$ is odd and $m+n +1$ is even so $4\not \mid b-a$ and $4\mid b+a$.

As a consequence $b^2 - a^2 = (b-a)(b+a)$ is divisible by $8$.
So if we have $2n + 1 = a^2$ then $a^2$ is odd so $a$ is odd.
AND we have $2n = a^2 -1 = (a-1)(a+1)$ is divisible by $8$ so $n$ is even.
And if $3n + 1=b^2$ then we have $n$ is even so $b^2$ is odd so $b$ is odd.
So $n = (3n+1)-(2n+1) =b^2 - a^2$ where $a,b$ are both odd..... which is divisible by $8$.
