$\begingroup$

Let's try, for example, $\sqrt5$:

Since that $2\lt\sqrt5\lt3$, the first term is $2$. Subtract $2$ and invert: $$ \frac1{\sqrt5-2}=\sqrt5+2 $$ Since $4\le\sqrt5+2\le5$, the next term is $4$. Subtract $4$ and invert: $$ \frac1{\sqrt5+2-4}=\sqrt5+2 $$ We are at the same point as the previous line. Thus, the continued fraction is $$ (2;4,4,4,4,\dots) $$ Let's try $\sqrt3$:

Since $1\lt\sqrt3\lt2$, the first term is $1$. Subtract $1$ and invert: $$ \frac1{\sqrt3-1}=\frac{\sqrt3+1}{2} $$ Since $1\lt\frac{\sqrt3+1}{2}\lt2$, the next term is $1$. Subtract $1$ and invert: $$ \frac2{\sqrt3+1-2}=\sqrt{3}+1 $$ Since $2\lt\sqrt3+1\lt3$, the next term is $2$. Subtract $2$ and invert: $$ \frac1{\sqrt{3}+1-2}=\frac{\sqrt3+1}2 $$ and we are back where we were two lines ago. Thus, the continued fraction is $$ (1;1,2,1,2,1,2,\dots) $$ In general, we may have to go several lines before we get the same remainder. It can be shown that roots of any quadratic polynomial with integer coefficients give a repeating continued fraction. Therefore, we will, at some point, get the same remainder.