# Thread: finite continued fractions ?

1. ## finite continued fractions ?

How to express the rational numbers as finite continued fractions ?
with last term >1

1. 118/303

2. 187/57

3. 10001/10101

4. 12/240005

2. $\displaystyle \frac{{187}} {{57}} = 3 + \frac{{16}} {{57}} = 3 + \frac{1} {{{\raise0.5ex\hbox{$\scriptstyle {57}$} \kern-0.1em/\kern-0.15em \lower0.25ex\hbox{$\scriptstyle {16}$}}}} = 3 + \frac{1} {{3 + {\raise0.5ex\hbox{$\scriptstyle 9$} \kern-0.1em/\kern-0.15em \lower0.25ex\hbox{$\scriptstyle {16}$}}}} = 3 + \frac{1} {{3 + \tfrac{1} {{1 + \tfrac{7} {9}}}}}$

$\displaystyle \frac{{187}} {{57}} = 3 + \frac{1} {{3 + \tfrac{1} {{1 + \tfrac{7} {9}}}}} = 3 + \frac{1} {{3 + \tfrac{1} {{1 + \tfrac{1} {{1 + \tfrac{2} {7}}}}}}} = 3 + \frac{1} {{3 + \tfrac{1} {{1 + \tfrac{1} {{1 + \tfrac{1} {{3 + \tfrac{1} {2}}}}}}}}}$

Do you see how I did it?

3. Here is another approach you can take.

Use the Euclidean algorithm on $\displaystyle 187,57$:

$\displaystyle 187 = 3\cdot 57 + 16$
$\displaystyle 57 = 3\cdot 16 + 9$
$\displaystyle 16 = 1\cdot 9 + 7$
$\displaystyle 9 = 1\cdot 7+2$
$\displaystyle 7 = 3\cdot 2 + 1$
$\displaystyle 2 = 1\cdot 1+0$

Thus, $\displaystyle 187/57 = [3;3,1,1,3,1]$.

Now why does this not match what PaulRS did?
Probably a computational mistake somewhere, I do not have time to check it now.

4. Originally Posted by ThePerfectHacker
$\displaystyle 2 = 1\cdot 1+0$