Math Calculators
Continued Fraction Converter - Best Rational Approximations
Convert any decimal or fraction to its continued fraction representation [a₀; a₁, a₂, …]. Shows all convergents - the best rational approximations to any real number.
Enter a decimal or fraction (e.g. 22/7). Press Enter or click Convert.
Famous examples:
Continued Fraction
[3; 7, 15, 1, 288, 1, 2, 1, 3, 1, 7, 4]
Finite CF (rational number: 62831853/20000000)
Coefficients [a₀; a₁, a₂, …]
Convergents (best rational approximations)
| # | CF terms used | Fraction | Decimal | Error |
|---|---|---|---|---|
| 1 | [3] | 3/1 | 3.000000000 | 1.42e-1 |
| 2 | [3; 7] | 22/7 | 3.142857143 | 1.26e-3 |
| 3 | [3; 7, 15] | 333/106 | 3.141509434 | 8.32e-5 |
| 4 | [3; 7, 15, 1] | 355/113 | 3.141592920 | 2.70e-7 |
| 5 | [3; 7, 15, 1, 288] | 102573/32650 | 3.141592649 | 6.89e-10 |
| 6 | [3; 7, 15, 1, 288, 1] | 102928/32763 | 3.141592650 | 2.46e-10 |
| 7 | [3; 7, 15, 1, 288, 1, 2] | 308429/98176 | 3.141592650 | 6.52e-11 |
| 8 | [3; 7, 15, 1, 288, 1, 2, 1] | 411357/130939 | 3.141592650 | 1.26e-11 |
| 9 | [3; 7, 15, 1, 288, 1, 2, 1, 3] | 1542500/490993 | 3.141592650 | 2.95e-12 |
| 10 | [3; 7, 15, 1, 288, 1, 2, 1, 3, 1] | 1953857/621932 | 3.141592650 | 3.22e-13 |
| 11 | [3; 7, 15, 1, 288, 1, 2, 1, 3, 1, 7] | 15219499/4844517 | 3.141592650 | 1.07e-14 |
| 12 | [3; 7, 15, 1, 288, 1, 2, 1, 3, 1, 7, 4] | 62831853/20000000 | 3.141592650 | 0 |
What is a continued fraction?
A continued fraction is an expression of the form a₀ + 1/(a₁ + 1/(a₂ + 1/(a₃ + …))), written compactly as [a₀; a₁, a₂, …]. Every real number has a continued fraction expansion, and every rational number has a finite one.
Famous continued fractions
- π = [3; 7, 15, 1, 292, 1, 1, 1, 2, …]
- e = [2; 1, 2, 1, 1, 4, 1, 1, 6, …] (beautiful pattern!)
- √2 = [1; 2, 2, 2, 2, …] (periodic)
- φ (golden ratio) = [1; 1, 1, 1, …] (all ones: "worst" approximable number)
- 355/113 = [3; 7, 16]: an unusually precise approximation of π
Why are convergents the best approximations?
A convergent pₙ/qₙ is closer to the target than any other fraction with denominator ≤ qₙ. This makes continued fractions the theoretically optimal tool for rational approximation: it's important in gear design, music theory (equal temperament), and calendar design (when is a year divisible by a simple fraction?).
The significance of large coefficients
A large coefficient aₖ (like 292 in π's expansion) means the previous convergent is an exceptionally good approximation. The fraction 355/113 is so accurate because the next coefficient is 292, meaning the next improvement requires a denominator roughly 292 times larger.
Connection to the Euclidean algorithm
The continued fraction expansion of a rational number a/b (where a > b) produces exactly the same sequence of quotients as running the Euclidean GCD algorithm on a and b. For example, to find gcd(34, 21):
34 = 1×21 + 13 -> quotient 1
21 = 1×13 + 8 -> quotient 1
13 = 1× 8 + 5 -> quotient 1
8 = 1× 5 + 3 -> quotient 1
5 = 1× 3 + 2 -> quotient 1
3 = 1× 2 + 1 -> quotient 1
2 = 2× 1 + 0 -> quotient 2 So 34/21 = [1; 1, 1, 1, 1, 1, 2] in continued fraction notation - the Fibonacci quotients, which is why consecutive Fibonacci numbers are the "worst case" for the Euclidean algorithm (requiring the most steps for their size). This deep connection between continued fractions and the GCD algorithm was known to Euler.