Continued Fraction Calculator
Convert rational numbers or decimals to continued fraction form [a₀; a₁, a₂, …]. Compute convergents (best rational approximations), reverse CF to fraction, and explore periodic CFs for quadratic irrationals.
Continued Fraction [a₀; a₁, a₂, …]
—
Convergents (best approximations) —
Verify reconstruction —
Extended More scenarios, charts & detailed breakdown ▾
CF Expansion
—
Convergents —
Decimal value —
Professional Full parameters & maximum detail ▾
Expansion & Convergents
CF Expansion —
All Convergents —
Theory & Applications
Famous π approximations via CF —
Periodic CF Note —
Applications —
How to Use This Calculator
- Enter a numerator and denominator for p/q → CF conversion.
- Use Decimal → CF tab to convert a decimal like 3.14159 to its CF.
- Use CF → Rational to reconstruct a fraction from CF terms.
- Use Professional to explore convergents and famous approximations.
Formula
CF: p/q = a₀ + 1/(a₁ + 1/(a₂ + …))
Convergents: hₙ/kₙ where hₙ=aₙhₙ₋₁+hₙ₋₂, kₙ=aₙkₙ₋₁+kₙ₋₂
Example
22/7: 22÷7=3 rem 1; 7÷1=7 rem 0 → CF=[3;7]. Convergents: 3/1, 22/7. 355/113=[3;7,15,1] ≈ π to 6 decimal places.
Frequently Asked Questions
- A continued fraction writes a number as a₀ + 1/(a₁ + 1/(a₂ + …)) where a₀ is an integer and all subsequent aᵢ are positive integers. Every rational number has a finite CF; irrationals have infinite CFs.
- Convergents are the fractions obtained by truncating the CF. They are the best rational approximations — no fraction with a smaller denominator is closer to the original value. Example: 22/7 and 355/113 are convergents of π.
- 355/113 ≈ 3.1415929, accurate to 6 decimal places. It is a convergent of π's CF [3;7,15,1,292,…]. The next term 292 is large, meaning the approximation is especially good.
- By Lagrange's theorem, a number has a periodic CF if and only if it is a quadratic irrational: √2=[1;2,2,2,…], golden ratio φ=[1;1,1,1,…], √3=[1;1,2,1,2,…].
- Best gear ratios in mechanical engineering, musical scale tuning (5/4≈major third), calendar systems (leap years balance 365.2422…), and Diophantine approximation in number theory.
Related Calculators
Sources & References (5) ▾
- An Introduction to the Theory of Numbers — Hardy & Wright — Oxford University Press
- Continued Fractions — A. Ya. Khinchin — Dover Publications
- Continued Fraction — Wolfram MathWorld — Wolfram Research
- OEIS A001203 — Continued fraction for π — OEIS Foundation
- Stern-Brocot Tree — Concrete Mathematics (Graham, Knuth, Patashnik) — Addison-Wesley