# How to find a continued fraction

How does one find the value of

$$1+\cfrac 1 {2+\cfrac 2 {3+\cfrac{3}{4+\cfrac{4}{5+\cfrac{5}{\ddots}}}}} \ \text{ or }\ 1+\cfrac{2}{3+\cfrac{4}{5+\cfrac{6}{7+\cfrac{8}{9+\cfrac{10}{\ddots}}}}}$$

Is there any way to find a continued fraction that is not necessarily periodic, but has a definite pattern to it?

There are several answers, but to your obvious question, the first c.f. value is $$\;1/(e-2)\approx 1.392211\;$$ given by the OEIS sequence A194807 and the second is $$\;1/(\sqrt{e}-1)\approx 1.541494\;$$ given by the OEIS sequence A113011. For your second question, there are other examples such as in the Wikipedia article Gauss's continued fraction and various q-continued fractions such as Wikipedia article Rogers-Ramanujan and MSE question 1347034

Any rational number $\frac mn$ can be converted to a finite simple continued fraction, via the Euclidean algorithm: if $m = nq + r$ then $\frac mn = q +\frac rn = q + \frac{1}{\frac nr}$ and the process continues by dividing $n$ by $r$.

I'll Leave a link to Mathologer video where it is better explained .

Using the Euclidean algorithm, one can find the continued fraction of any rational number. For irrational numbers, it requires a bit of algebraic manipulation.

For example let's reduce $\dfrac{2335}{150}$ to a continued fraction

using the Euclidean algorithm

$$2335 = 150(15) + 85$$

$$150 = 85(1) + 65$$

$$85 = 65(1) + 20$$

$$65 = 20(3)+ 5$$

$$20 = 5(4) + 0$$

Using this we have, $$\frac{2335}{150} = 15 + \cfrac{85}{150} = 15 + \frac{1}{\frac{150}{85}} = 15 +\cfrac{1}{1 + \frac{65}{85}} = 15 + \cfrac{1}{1 + \cfrac{1}{\frac{85}{65}}}$$ so on until...

$$\frac{2335}{150} = 15 +\cfrac{1}{1+\cfrac{1}{1+ \cfrac{1}{3+\frac{1}{4}}}}$$

Also if you want to find the value of an infinite continued fraction say of $\pi$ ,you can just try cutting the fraction at certain parts and calculating the value. The value will approach the value of the number.You can try it with the fractions you've listed which evaluate out to $\approx1.3922$ and $\approx1.5414$ respectively.

Mathologer video on continued fractions and irrational numbers