Positive integer $n$ such that $2n+1$ , $3n+1$ are both perfect squares
How many positive integer $n$ are there such that $2n+1$ , $3n+1$ are both perfect squares ?
$n=40$ is a solution . Is this the only solution ? Is it possible to tell whether finitely many or infinitely many solutions exist ?
The quick version is $n_0 = 0, \; \; n_1 = 40,$ then $$ \color{magenta}{ n_{k+2} = 98 n_{k+1} - n_k + 40}. $$
Given an $(x,y)$ pair with $3x^2 - 2 y^2 = 1$ we then take $n = (x^2-1)/ 2 = (y^2 - 1)/ 3. $
The first few $x,y$ pairs are $$ x=1, \; y= 1 , \; n=0 $$ $$ x=9, \; y=11, \; n=40 $$ $$ x= 89, \; y=109, \; n=3960 $$ $$ x=881, \; y=1079, \; n= 388080 $$ $$ x=8721, \; y=10681, \; n= 38027920 $$ $$ x=86329, \; y=105731, \; n= 3726348120 $$ and these continue forever with $$ x_{k+2} = 10 x_{k+1} - x_k, $$ $$ y_{k+2} = 10 y_{k+1} - y_k. $$ $$ n_{k+2} = 98 n_{k+1} - n_k + 40. $$
People seem to like these recurrences in one variable. The underlying two-variable recurrence in the pair $(x,y)$ can be abbreviated as $$ (x,y) \; \; \rightarrow \; \; (5x+4y,6x+5y) $$ beginning with $$ (x,y) = (1,1) $$ The two-term recurrences for $x$ and $y$ are just Cayley-Hamilton applied to the matrix $$ A \; = \; \left( \begin{array}{rr} 5 & 4 \\ 6 & 5 \end{array} \right) , $$ that being $$ A^2 - 10 A + I = 0. $$
If $2n+1=x^2$ and $3n+1=y^2$ then $$3x^2-2y^2=1\ .$$ Multiplying by $-2$ and substituting $X=2y$, $Y=x$, this can be written as a Pell-type equation $$X^2-6Y^2=-2\ .$$ This has infinitely many solutions, some of which are given by $X=X_n$, $Y=Y_n$ where $$X_n+Y_n\sqrt6=(2+\sqrt6)(5+2\sqrt6)^n\ .\tag{$*$}$$ For example, taking $n=1$ gives $$X=22,\ Y=9,\ x=9,\ y=11$$ and hence $n=40$, the solution you have already. Equation $(*)$ gives the recurrences $$X_{n+1}=5X_n+12Y_n\ ,\quad Y_{n+1}=2x_n+5y_n\ ,$$ and it is then possible to eliminate the $Y$ terms to get $$X_{n+2}=10X_{n+1}-X_n$$ and similar relations for $x_n$ and $y_n$.
For a more detailed explanation of the method (applied to a slightly different equation), see my answer to this question.
If $2n+1$ is a square then it is (obviously?) of the form $4m^2+4m+1$ and thus $3n+1=6m^2+6m+1$ and so the question can be rephrased:
When is $6m^2+6m+1$ a square for integer $m$?
Which is trivially rephrased:
What are the integer solutions of $6x^2-y^2+6x+1=0$?
which can be answered at
http://www.alpertron.com.ar/QUAD.HTM
(sorry for the cop-out but it's better than nothing).