Let
\[x_1, \; y_1\]
be the fundamental - smallest - solutions of \[x^2-ny^2=1\]
. For each \[k \ge 1\]
, \[x=x_k, \; y=y_k\]
is also a solution, found from \[x_k+\sqrt{n} y_k=(x_1+ \sqrt{n} y_1 )^k\]
.Conversely, the solutions given in this way are the only positive solutions.
Proof
\[\begin{equation} \begin{aligned} (x_1^2-n y_1^2)^k &= (x_k+\sqrt{n} y_k)(x_k-\sqrt{n} y_k) \\ &= (x_1+\sqrt{n} y_1)^k(x_1-\sqrt{n} y_1)^k \\ &= (x_1^2-n y_1^2)^k \\ &= 1^k=1 \end{aligned} \end{equation}\]
So all
\[x_k, \; y_k\]
are solutions.Suppose there are other solutions, say
\[x=1, \; y=b\]
. \[x=x_1, \; y=y_1\]
is the smallest solution, and \[x_1+\sqrt{n} y \gt 1\]
so there exists \[k\]
such that \[(x_1+\sqrt{n} y_1)^k \lt a + b \sqrt{n} \lt (x_1+\sqrt{n} y_1)^{k+1}\]
.Multiply through by
\[(x_k- y_k \sqrt{n})= (x_1- y_1 \sqrt{n})^k= \frac{1}{(x_1+ y_1 \sqrt{n})^k} \gt 0\]
.\[(x_1+\sqrt{n} y_1)^k (x_1- y_1 \sqrt{n})^k \lt (a + b \sqrt{n})(x_k- y_k \sqrt{n}) \lt (x_1+\sqrt{n} y_1)^{k+1}(x_1- y_1 \sqrt{n})^k\]
.The expression simplifies to
\[1 \lt (a + b \sqrt{n})(x_k- y_k \sqrt{n})=ax_k-by_kn+(bx_k-ay_k) \sqrt{n} \lt x_1+y_1 \sqrt{n}\]
  (1)Hence
\[x=ax_k-by_kn. \; y= bx_k-ay_k\]
are also solutions but (1) implies that this solution is less than the fundamental - smallest - solution, which a contradiction, so the theorem is proved.Example:
\[x_1=3, \; y_1=\]
is a solution of \[x^2-8y^2=1\]
and so are\[(3+ \sqrt{8})^2=17+6 \sqrt{8} \rightarrow x_2=17, \; y_2=6\]
\[(3+ \sqrt{8})^3=17+6 \sqrt{8} \rightarrow x_3=99, \; y_2=35\]
and so on.