<s>[INST] 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 ? 
 [/INST] $2n+1=x^2$ and $3n+1=y^2$
since , $x $ is odd let $x=2m+1$
$2n+1=4m^2+4m+1$
$n=2 (m)(m+1) $...... (eqn1)
This means $4|n $; 
$y^2= 6m (m+1) $
$let y=2t+1$
From last two,
$3 (m)(m+1)=2t (t+1) $
Since , $2|t (t+1) $; this implies  $4|m (m+1) $ and this implies $8|n $ ... (from eqn 1).
Now it remains to prove that $5|n$
Qudratic residue for $mod5$ are {0,1,4}
So, $x^2= {0 or 1 or 4}$ $ mod5$
Also $y^2= {0 or 1 or 4}$ $ mod 5$
The only possible is $ n= 0 mod 5$. (According to first two equations)
</s>