This is as much notes for me as it is something useful for you. But maybe it will be useful for you? Who knows?

Suppose I want to know the continued fraction of $r=\sqrt{19}$. How do I find that?

Well, it’s going to be a whole number (call it $y_0$) plus something else – and I know the whole number is 4, so I can say $y_0=4$ and write $r = 4 + \frac{1}{x_1}$.

A bit of rearrangement gives $x_1 = \frac{1}{r - 4}$, and rationalising the denominator – when were you ever going to use that in real life? – gives $x_1 = \frac{r+4}{r^2 - 16}$ – and we know that the denominator is 3.

That doesn’t feel \em{that} much better – now we’ve got $x_1 = \frac{r+4}{3}$ – but again, we’re going to say that’s a whole number plus a fraction. Since $r$ is between 4 and 5, the whole number is going to be $y_1=2$.

So, $x_1 = 2 + \frac{r-2}{3}$, and we’re going to call that fraction $\frac{1}{x_2}$.

That is, $x_2 = \frac{3}{r-2}$, which becomes $\frac{3(r+2)}{r^2 - 4}$. We know that $r^2-4$ is 15, and that will cancel with the 3 to give $x_2 = \frac{r+2}{5}$. Again, that’s a whole number and a bit more – the whole number is $y_2=1$.

Let’s keep going. Take away the one to give $\frac{r-3}{5}$, so $x_3 = \frac{5}{r-3}$. Do the dance again and we get $x_3 = \frac{5(r+3)}{10}$, or $\frac{r+3}{2}$. It’s a bit more than 3, so $y_3 = 3$ and we’re left with $\frac{r-3}{2}$ when we subtract it.

Now $x_4 = \frac{2}{r-3}$, or $\frac{2(r+3)}{10}$, which is $\frac{r+3}{5}$. $y_4 = 1$ and we have $\frac{r-2}{5}$ left.

Surely we’re getting close now? $x_5 = \frac{5}{r-2}$, or $\frac{5(r+2)}{15}$, which is $\frac{r+2}{3}$. $y_5$ is 2, and we’re left with $\frac{r-4}{3}$.

And finally, $x_6 = \frac{3}{r-4}$, which is $\frac{3(r+4)}{3}$, or $r+4$ – which we know from before is equal to $8+x_0$!

Now we just need to list out all of our $y$s to get a continued fraction of $\left[4; \overline{2,1,3,1,2,8}\right]$.

That’s lovely (ish – it took a bit more work than I hoped!) – but now I wonder if there’s some sort of symmetry to the process. It has a sort of long-division feel to it.