# rational continued fractions

I've heard of continued fractions, like

$$a=\cfrac{b}{c+\cfrac{d}{e+\cfrac{f}{g+...}}}$$

usually written like:

$$a+\frac{b}{c+}\frac{d}{e+}\frac{f}{g+...}$$

(in my opinion, it's pure genius!) I've heard of some simple ones like:

$$\sqrt 2=\frac{1}{1+}\frac{1}{1+}\frac{1}{1+}\frac{1}{1+}\frac{1}{1+}\frac{1}{1+}\frac{1}{1+...}$$

my question is, is there any way to make rational numbers like $\frac{x}{y}$ into continued fractions that terminate?

• en.wikipedia.org/wiki/… – Will Jagy Apr 12 '17 at 16:04
• Possible duplicate of How to find continued fraction of pi – MJD Apr 12 '17 at 16:30
• Note that the top-scoring answer there directly addresses your question about continued fractions for rational numbers. It begins “Here is how you find the continued fraction for any number at all” and ends “Repeat as desired, or stop if $x_i$ becomes 0, which will happen if and only if the original $x_0$ was rational”. – MJD Apr 12 '17 at 16:31

Yes, all rational numbers have terminating continued fractions even when you require that all the numerators be $1$. Wikipedia shows how to compute it and that there are exactly two representations. It should be clear that any finite continued fraction is rational-just unpack it and use the closure of the rationals under addition and multiplication.