Question Find integers $x,y$ such that $$x^2-119y^2=1.$$
So far I've tried computing the continued fraction of $\sqrt{119}$ to find the minimal solution, but either I messed up or I don't know where to stop computing a rough approximation of said square root. Please help.
We will compute the continued fraction by the following algorithm (may or may not be the most efficient way in doing this, but it's the way I was taught!):
We set the following $$x:=\sqrt{119},\quad x_0=x,\quad a_i=\lfloor x_i\rfloor,\quad x_{i+1}=(x_i-a_i)^{-1},$$
and then we stop once we reach a loop in $x_i$ terms and list those terms as the continued fraction.
So, carrying out this procedure gives $$x_0=\sqrt{119},\quad a_0=\lfloor\sqrt{119}\rfloor=10,$$ $$x_1=\frac{1}{\sqrt{119}-10}=\frac{\sqrt{119}+10}{19},\quad a_1=\lfloor\frac{\sqrt{119}+10}{19}\rfloor=1,$$ $$x_2=\frac{1}{\frac{\sqrt{119}+10}{19}-1}=\frac{1}{\frac{\sqrt{119}-9}{19}}=\frac{19}{\sqrt{119}-9}=\frac{19(\sqrt{119}+9)}{38}=\frac{\sqrt{119}+9}{2},\quad a_2=\lfloor \frac{\sqrt{119}+9}{2}\rfloor=9,$$ $$x_3=\frac{1}{\frac{\sqrt{119}+9}{2}-9}=\frac{\sqrt{119}+9}{19},\quad a_3=\lfloor\frac{\sqrt{119}+9}{19}\rfloor=1,$$ $$x_4=\frac{1}{\frac{\sqrt{119}+9}{19}-1}=10+\sqrt{119},\quad a_4=\lfloor10+\sqrt{119}\rfloor=20,$$ $$x_5=\frac{1}{10+\sqrt{119}-20}=\frac{1}{\sqrt{119}-10}=x_1.$$ Since we have reached a loop in terms, we stop. Thus $$\sqrt{119}=[10;\overline{1,9,1,20}].$$ From here, we note that the period of this continued fraction is $4$ and so, the fundamental solution arises in the third partial convergent. We compute it as follows $$[10;1,9,1]=10+\frac{1}{1+\frac{1}{9+\frac{1}{1+1}}}=\frac{120}{11}.$$ So the pair $(120,11)$ is the smallest solution. Indeed $$120^2-119\times 11^2=1.$$ Finally, to generate all the solutions to this equation, we take the form $$(120+11\sqrt{119})^n,$$ where $n\in\Bbb N$.