Continued Fraction Calculator
Convert a fraction to its continued fraction representation. Shows coefficients, convergents, and approximation error.
About this calculator
A continued fraction rewrites a ratio as a whole number plus one over another whole number plus one over another, nested as deep as the fraction requires, and this calculator finds that nesting the same way it has been found for centuries: the Euclidean algorithm. Each coefficient is the integer part of dividing the current numerator by the current denominator, after which the remainder becomes the new denominator and the process repeats — exactly the same steps used to find a greatest common divisor, just with every intermediate quotient recorded instead of thrown away. The default 355 over 113 is the classic approximation of pi, and it produces an unusually short continued fraction with a strikingly large third coefficient, which is precisely why 355/113 approximates pi to six decimal places despite having a denominator under 1,000 — a large coefficient partway through a continued fraction signals that the convergent just before it is an exceptionally good, disproportionately simple approximation.
Alongside the coefficient list, the calculator reconstructs the Final Convergent — the best rational approximation the expansion builds up to — by working the coefficients back into a fraction from the top down, and reports how far that convergent sits from the original ratio as Approximation Error. The expansion is capped at 20 coefficients regardless of how long the true continued fraction would run, so a numerator and denominator that share very few common factors partway through will be cut off before reaching an exact match.
Inputs
Results
Continued Fraction
[3; 7, 16]
How to Use This Calculator
- Enter Numerator and Denominator.
- Review the Continued Fraction result.
- Use Number of Terms and Final Convergent to inform your decision.
- Use the chart to visualize the results and explore different scenarios by adjusting inputs.
What each input means
- Numerator
- Numerator of the fraction (e.g., 355 for the classic pi approximation 355/113)
- Denominator
- Denominator of the fraction
How this is calculated
Worked example, using the default values
- Identify Input ParametersNumerator = 355, Denominator = 113 = 2 input(s) provided
- Calculate Continued FractionContinued Fraction[3; 7, 16] = [3; 7, 16]
- Calculate Number of TermsNumber of Terms3 = 3
- Calculate Final ConvergentFinal Convergent355/113 = 355/113
Engine last updated . Checked against 2 independently-derived tests — how we verify calculators. Built by Paul Gunder, a software engineer, not a licensed financial, medical, or legal professional.
Frequently Asked Questions
Why is 355/113 the default fraction?
It is the classic rational approximation of pi, accurate to six decimal places despite a denominator under 1,000. Its continued fraction expansion, [3; 7, 16], has an unusually large third coefficient, which is exactly the pattern that signals an exceptionally good approximation is hiding in the fraction.
How are the coefficients actually computed?
The calculator runs the Euclidean algorithm: divide the numerator by the denominator and keep the whole-number quotient as a coefficient, then repeat with the old denominator and the remainder standing in as the new pair. That is the same process used to compute a greatest common divisor.
What does the Approximation Error figure represent?
It measures the gap between the original fraction you entered and the Final Convergent the calculator reconstructs from the coefficient list. Because the calculator folds every coefficient back into the convergent, the error is exactly 0 whenever the expansion finishes normally — that is the ordinary case, not a rare one, and in it the convergent's denominator matches the input's exactly (unless the input wasn't already in lowest terms). A nonzero error is actually the signal that something was cut short: the 20-term cap truncated the expansion before it could finish.
Why does the expansion sometimes stop at exactly 20 terms?
20 is a hard cap the calculator applies regardless of how long the true continued fraction would run. A numerator and denominator that share very few factors partway through the Euclidean algorithm will be cut off there rather than continuing to an exact final term.
Related Calculators
The questions that sit next to this one — chosen by subject, including calculators filed under a different category.
Fibonacci Calculator
Calculate the nth Fibonacci number, its predecessor, and the golden ratio approximation F(n)/F(n-1).
Number TheoryEuler's Totient Calculator
Calculate Euler's totient function phi(n) — the count of integers from 1 to n that are coprime to n.
Number TheoryChinese Remainder Theorem Calculator
Solve systems of congruences using the Chinese Remainder Theorem. Find x such that x ≡ r1 (mod m1) and x ≡ r2 (mod m2).
More in Math & Statistics.