Fractions Inside Fractions
A continued fraction peels back a real number layer by layer: first the integer part, then a reciprocal remainder, then the integer part of that, and so on. The notation [a₀; a₁, a₂, ...] compactly encodes this nested structure. Unlike decimal expansions, continued fractions naturally reveal the best rational approximations to a number — the convergents obtained by truncating the expansion. This simulator computes the CF of any fraction and animates how convergents home in on the target value.
Convergents and Best Approximations
Each truncation of a continued fraction yields a convergent pₙ/qₙ that alternates above and below the true value. A remarkable theorem guarantees that convergents are the best rational approximations: no fraction with a smaller denominator comes closer to the target. The recurrence relations pₙ = aₙ pₙ₋₁ + pₙ₋₂ and qₙ = aₙ qₙ₋₁ + qₙ₋₂ make convergents easy to compute iteratively.
Large Partial Quotients
When a large partial quotient appears in the CF expansion, the previous convergent is an unusually good approximation. The classic example is π = [3; 7, 15, 1, 292, ...] — the term 292 makes 355/113 accurate to six decimal places, known to Zu Chongzhi in 5th-century China. Conversely, the golden ratio φ = [1; 1, 1, 1, ...] has all-1 partial quotients, making it the most poorly approximable irrational number.
Applications Beyond Number Theory
Continued fractions appear throughout mathematics and engineering. The Euclidean algorithm is secretly a CF computation. Pell's equation x² - Dy² = 1 is solved via the CF of √D. In signal processing, CF-based rational approximations optimize filter design. Calendar algorithms use CFs to find leap year cycles: the 97/400 Gregorian rule comes from the CF of the tropical year minus 365.