Find high common factor of all possible $n$ If $n$ is an integer such that $2n + 1$ and $3n + 1$ are square numbers, find the highest common factor of all possible $n$.
Do we need to know exactly what all possible $n$ are?

As $n=40$ gives us the squares $81=9^2$ and $121=11^2$, the desired number $d$ is a divisor of $40$, which limit sour search from above.
As $2n+1$ is an odd square, it os $\equiv 1\pmod 8$, hence $n\equiv 0\pmod 4$. But then $3n+1$ is also odd, hence $\equiv 1\pmod 8$, hence $8\mid n$.
Thus the only remaining possibilities are $d=0$ or $d=40$, and we need to check $n\bmod 5$.
Note that $2$ and $3$ ar enot squares $\bmod 5$.
If $n\equiv 1\pmod 5$, then $2n+1\equiv 3$; if $n\equiv 2\pmod 5$, then $3n+1\equiv 2$; if $n\equiv 3\pmod 5$, then $2n+1\equiv 2$; if $n\equiv 4\pmod 5$, then $3n+1\equiv 3$. It follows that $n\equiv 0\pmod 5$.
We conclude that $d=40$.
