CacheHackCacheHack

Continued Fractions

Convert decimals to continued fractions and find best rational approximations. Useful for number theory puzzles.

Limit continued fraction length

Famous Continued Fractions

Golden ratio φ= 1.618034
[1, 1, 1, 1, 1, 1, 1, ...]
π= 3.141593
[3, 7, 15, 1, 292, 1, 1, 1, ...]
e= 2.718282
[2, 1, 2, 1, 1, 4, 1, 1, 6, ...]
√2= 1.414214
[1, 2, 2, 2, 2, 2, 2, ...]
√3= 1.732051
[1, 1, 2, 1, 2, 1, 2, ...]

Notation

[a₀; a₁, a₂, a₃, ...] means: a₀ + 1/(a₁ + 1/(a₂ + 1/(a₃ + ...)))

Example: [3; 7, 15, 1] = 3 + 1/(7 + 1/(15 + 1/1)) = 355/113 ≈ π

What are Continued Fractions?

A continued fraction represents a number as a sequence of integers in a nested fraction form. Any real number can be written as a continued fraction, and rational numbers have finite continued fractions.

The Notation

A continued fraction [a₀; a₁, a₂, a₃, ...] represents:

a₀ + 1/(a₁ + 1/(a₂ + 1/(a₃ + ...)))

Convergents

Convergents are the best rational approximations you get by truncating the continued fraction. Each convergent is closer to the target number than any other fraction with a smaller denominator.

Famous Examples

  • Golden ratio φ: [1; 1, 1, 1, ...] - all ones, the "most irrational"
  • π: [3; 7, 15, 1, 292, ...] - gives 22/7 and 355/113
  • √2: [1; 2, 2, 2, ...] - periodic after first term
  • e: [2; 1, 2, 1, 1, 4, 1, 1, 6, ...] - interesting pattern

Continued Fractions in Puzzles

Continued fractions appear in puzzles involving:

  • Number theory: Finding rational approximations
  • Golden ratio: Fibonacci connections
  • Periodic patterns: Square roots have repeating CF
  • Historical math: Ancient approximations to π

Properties

  • Rational numbers have finite continued fractions
  • Quadratic irrationals (like √2) have periodic continued fractions
  • The golden ratio has the simplest infinite continued fraction
  • Convergents alternate between over and under estimates