A continued fraction rewrites a number as a nested stack of integer divisions, [a0; a1, a2, ...], and in the process reveals the best possible rational approximations to that number at every level of precision. This guide explains how the expansion is built, what convergents are good for, and how continued fractions relate to two calculators you may already be using: the Euclidean algorithm behind the GCF & LCM Calculator, and simple fractions.
How the expansion is built
The expansion works by repeatedly separating a number into its whole-number part and its fractional remainder, then flipping the remainder upside down and repeating. Formally, an = floor(xn) and the next value is xn+1 = 1 / (xn - an). Feeding an exact fraction through this process is identical to running the Euclidean algorithm on its numerator and denominator — the sequence of quotients produced is exactly the sequence of partial quotients in the continued fraction. That is also why every rational number's expansion terminates: the Euclidean algorithm always reaches a remainder of 0 in finitely many steps.
What convergents are good for
Truncating the expansion after n terms gives a convergent pn/qn, computed from the recurrence pn = an·pn-1 + pn-2 and qn = an·qn-1 + qn-2. Convergents are provably the best rational approximations available for their denominator size — no other fraction with a denominator that small gets closer. This is exactly why 22/7 and 355/113 are the classic approximations for pi, why calendar reform proposals use continued-fraction convergents of the solar year to decide leap-year rules, and why mechanical gear trains are designed around convergents when an exact ratio is impractical to cut.
Terminating vs. infinite expansions
Every rational number a/b has a finite continued fraction, and the last convergent always reconstructs a/b exactly — this calculator's Steps tab shows that termination happening live. Irrational numbers, by contrast, have infinite expansions that never repeat into an exact match; this tool caps the display at your chosen max-terms setting (up to 30) and labels the result as capped rather than exact whenever the true expansion keeps going. If you're working with plain fractions rather than expansions, the Fraction Calculator and Prime Factorization Calculator cover related ground, and the Modulo Calculator exposes the remainder operation this expansion is built from.