Continued Fractions Calculator
Convert rational numbers to continued fraction representation and compute convergents
A continued fraction represents a number as a sequence of integer quotients. For a rational number p/q, the algorithm repeatedly divides and takes remainders (similar to the Euclidean algorithm).
- Divide the numerator by the denominator to get the integer part (a₀)
- Take the reciprocal of the fractional remainder
- Repeat until the remainder is zero
- The sequence [a₀; a₁, a₂, ...] is the continued fraction representation
Convergents are computed using the recurrence relations:
- pₙ = aₙ × pₙ₋₁ + pₙ₋₂
- qₙ = aₙ × qₙ₋₁ + qₙ₋₂
Applications: Approximating irrational numbers (π ≈ 355/113), cryptography, solving Pell equations, calendar calculations, and gear ratio design.
Famous Example: The fraction 355/113 is an excellent approximation of π, accurate to 6 decimal places. Its continued fraction is [3; 7, 16].
What is a continued fraction?
A continued fraction represents a number as a sequence of integer quotients: a0 + 1/(a1 + 1/(a2 + 1/(a3 + ...))). Every rational number has a finite continued fraction, while irrationals have infinite ones. For example, 3.14159... = [3; 7, 15, 1, 292, ...].
Why are continued fractions useful?
Continued fractions provide the best rational approximations to any real number. The convergents (partial evaluations) give increasingly accurate fractions with small denominators. For example, 22/7 and 355/113 are famous approximations to pi derived from its continued fraction.
What is a convergent in continued fractions?
A convergent is a rational number obtained by truncating the continued fraction at some point. Each convergent is the best rational approximation with denominator not exceeding that of the convergent. They alternate between overestimates and underestimates of the true value.
How are continued fractions related to the Euclidean algorithm?
The Euclidean algorithm for finding GCD naturally produces the continued fraction representation. The quotients in each step of the algorithm become the terms of the continued fraction. This connection makes continued fractions fundamental in number theory.