TITLE: Continued fractions help
QUESTION [7 upvotes]: I'm trying to learn how to express a square root as continued fraction, but I can't get one thing.
The following example of $\sqrt{14}$ is from this page (click the image to see it at full size):

In the 2nd row of the table, can anyone please tell me where the 1 (in red) comes from?
For instance, why can't it be 2, or 3, or 4?
This is my only doubt, which I've been trying hard to understand, but unable to.

REPLY [2 votes]: More generally, if $x$ is real and $n$ is a natural number, then $$\left\lfloor \frac{x}{n}\right\rfloor = \left\lfloor \frac{\lfloor x\rfloor}{n}\right\rfloor$$
So in computing the continued fraction expansion of a square root of $D$, all the $x_i$ are of the form $$\frac{\sqrt D + A}{B}$$ and to find the integer part of this, we only need to find the integer part of:
$$\frac{\lfloor\sqrt D \rfloor+ A}{B}$$
That greatly simplifies the process of computing the integer parts at each step - the only "approximation" we need for $\sqrt{D}$ to compute this step is $\lfloor \sqrt{D}\rfloor$. Consider how much harder it would be if the $x_i$ could be of the form:
$$\frac{A_i\sqrt{D}+B_i}{C_i}$$
This essentially requirs a "better" estimate for $\sqrt{D}$ to find the integer part of this expression.