Continued fraction of a square root If I want to find the continued fraction of $\sqrt{n}$ how do I know which number to use for $a_0$? Is there a way to do it without using a calculator or anything like that? What's the general algorithm for computing it? I tried to read the wiki article but was overwhelmed and lost. I tried Googling but couldn't find a website that actually explained this question.
If anyone has a good site that answers these questions either, please let me know. Thanks!

Here the easiest method to generate continued fraction for any square (or more) root. Lets take $\sqrt{5}$:
$$\sqrt{5} \approx 2,2360679775...$$
$$\sqrt{5} = 2 + 0,2360679775$$
So $2=\left \lfloor \sqrt{5} \right \rfloor$
$$\sqrt{5} =2 + x$$ with $x=0,2360679775$
$$\sqrt{5}^{2} = (x + 2)^{2} \Rightarrow 5= x^2 + 4x + 4$$
$$1= x^2 + 4x$$
$$\frac{1}{x}= x + 4 \Rightarrow x = \frac{1}{4+x}$$
So $x = \frac{1}{4+\frac{1}{4+\frac{1}{4+\frac{1}{4+\ddots}}}}$
Finally, we got: $\sqrt{5} = 2 + \frac{1}{4+\frac{1}{4+\frac{1}{4+\frac{1}{4+\ddots}}}}$.
So for any $x$, $\sqrt{x} = \left \lfloor \sqrt{x} \right \rfloor + \frac{x-\left \lfloor \sqrt{x} \right \rfloor^{2}}{2\left \lfloor \sqrt{x} \right \rfloor+\frac{x-\left \lfloor \sqrt{x} \right \rfloor^{2}}{2\left \lfloor \sqrt{x} \right \rfloor+\frac{x-\left \lfloor \sqrt{x} \right \rfloor^{2}}{2\left \lfloor \sqrt{x} \right \rfloor + \ddots}}}$
So to answer, $a_0 =\left \lfloor \sqrt{x} \right \rfloor$ (because any periodic continued fraction is smaller than 1).
