TITLE: On the Pell-like $Ax^2-By^2 = 1$
QUESTION [7 upvotes]: This is connected to the post, Mere coincidence? (prime factors). I was looking at NeuroFuzzy's dataset and noticed the line,
{{{1, {4, 2}}, {1, 4, 2, 4, 2}, 23762}}
It seems this could be generalized. Is it true that given the equation,
$$(n+1)x^2-ny^2 = 1\tag{1}$$
then its solutions are given by,
$$\frac{y_1}{x_1} = 1+\cfrac{1}{2n+\cfrac{1}{2}} = \frac{4n+3}{4n+1}\tag{2}$$
$$\frac{y_2}{x_2} = 1+\cfrac{1}{2n+\cfrac{1}{2+\cfrac{1}{2n+\cfrac{1}{2}}}} = \frac{16n^2+20n+5}{16n^2+12n+1} \tag{3}$$
and so for all $x_i, y_i$? I assume it is connected to the fact that,
$$\sqrt{\frac{n+1}{n}} = 1+\cfrac{1}{2n+\cfrac{1}{2+\cfrac{1}{2n+\cfrac{1}{2+\ddots}}}}\tag{4}$$
and truncating $(4)$ at the right periodic points, correct?

REPLY [3 votes]: Here 
$$
 \left(  \begin{array}{c}
  x  \\
   y  
\end{array} 
  \right)
$$
will be a solution of $$ (n+1) x^2 - n y^2 = 1. $$
We have an "automorph" or generator of the automorphism group or isometry group or orthogonal group of the indefinite binary quadratic form depicted; the form is $ (n+1) x^2 - n y^2. $
$$ A = 
 \left(  \begin{array}{cc}
  2n+1  &  2 n  \\
   2n+2   &  2n+1  
\end{array} 
  \right)  ,
 $$ and 
$$  
 \left(  \begin{array}{cc}
  2n+1  &  2 n  \\
   2n+2   &  2n+1  
\end{array} 
  \right)  
 \left(  \begin{array}{c}
  1  \\
   1  
\end{array} 
  \right) =
 \left(  \begin{array}{c}
  4n+1  \\
   4n+3 
\end{array} 
  \right), 
 $$
$$  
 \left(  \begin{array}{cc}
  2n+1  &  2 n  \\
   2n+2   &  2n+1  
\end{array} 
  \right)  
 \left(  \begin{array}{c}
  4n+1  \\
   4n+3  
\end{array} 
  \right) =
 \left(  \begin{array}{c}
  16n^2 +12n+1  \\
   16 n^2 + 20 n + 5 
\end{array} 
  \right), 
 $$
$$  
 \left(  \begin{array}{cc}
  2n+1  &  2 n  \\
   2n+2   &  2n+1  
\end{array} 
  \right)  
 \left(  \begin{array}{c}
    16n^2 +12n+1  \\
     16 n^2 + 20 n + 5
\end{array} 
  \right) =
 \left(  \begin{array}{c}
 64 n^3 + 80 n^2 + 24 n + 1 \\
   64 n^3 + 112 n^2 + 56 n + 7  
\end{array} 
  \right), 
 $$
$$  
 \left(  \begin{array}{cc}
  2n+1  &  2 n  \\
   2n+2   &  2n+1  
\end{array} 
  \right)  
 \left(  \begin{array}{c}
    64 n^3 + 80 n^2 + 24 n + 1  \\
     64 n^3 + 112 n^2 + 56 n + 7
\end{array} 
  \right) =
 \left(  \begin{array}{c}
 256 n^4 + 448 n^3 + 240 n^2 + 40 n + 1 \\
  256 n^4 + 576 n^3 + 432 n^2 + 120 n + 9   
\end{array} 
  \right), 
 $$
and so on forever. Except for $\pm$ sign these are all.