[Math] Positive integer $n$ such that $2n+1$ , $3n+1$ are both perfect squares

number theory

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 ?

Best Answer

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. $$