Skip to content
Toolcroft

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₂, …]

a₀3
a17
a215
a31
a4288
a51
a62
a71
a83
a91
a107
a114

Convergents (best rational approximations)

#CF terms usedFractionDecimalError
1[3]3/13.0000000001.42e-1
2[3; 7]22/73.1428571431.26e-3
3[3; 7, 15]333/1063.1415094348.32e-5
4[3; 7, 15, 1]355/1133.1415929202.70e-7
5[3; 7, 15, 1, 288]102573/326503.1415926496.89e-10
6[3; 7, 15, 1, 288, 1]102928/327633.1415926502.46e-10
7[3; 7, 15, 1, 288, 1, 2]308429/981763.1415926506.52e-11
8[3; 7, 15, 1, 288, 1, 2, 1]411357/1309393.1415926501.26e-11
9[3; 7, 15, 1, 288, 1, 2, 1, 3]1542500/4909933.1415926502.95e-12
10[3; 7, 15, 1, 288, 1, 2, 1, 3, 1]1953857/6219323.1415926503.22e-13
11[3; 7, 15, 1, 288, 1, 2, 1, 3, 1, 7]15219499/48445173.1415926501.07e-14
12[3; 7, 15, 1, 288, 1, 2, 1, 3, 1, 7, 4]62831853/200000003.1415926500

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.