Continued Fractions

pi = 3 + 1/(7 + 1/(15 + 1/(1 + 1/(292 + ...))))
written [3; 7, 15, 1, 292, 1, 1, 1, 2, ...]

A continued fraction expresses a number as an integer plus the reciprocal of another continued fraction. Every real number has a unique continued fraction expansion. Rational numbers terminate; quadratic irrationals repeat periodically; transcendentals like pi have no pattern. The convergents (rational approximations formed by truncating) are provably the best approximations of any rational with that size denominator.

Famous continued fractions compared: periodic = quadratic irrational
CONSTANT CF NOTATION TYPE phi [1; 1, 1, 1, 1, ...] periodic sqrt(2) [1; 2, 2, 2, 2, ...] periodic sqrt(3) [1; 1, 2, 1, 2, ...] periodic e [2; 1, 2, 1, 1, 4, 1, 1, 6...] pattern pi [3; 7, 15, 1, 292, 1, ...] no pattern Theorem: a CF is periodic if and only if the number is a quadratic irrational (Lagrange, 1770) phi is the "hardest" to approximate: its CF of all 1s is the worst possible convergence
Convergents of pi: best rational approximations
CONVERGENT DECIMAL ERROR {[ ['3/1', '3.000000', '0.14159'], ['22/7', '3.142857', '0.00126'], ['333/106', '3.141509', '0.000083'], ['355/113', '3.141592..','0.0000003'], ['103993/33102','3.14159265..','2.7e-10'], ].map(([frac,dec,err],i) => { const y = 50+i*22 return `${frac}${dec}${err}` }).join('')} 355/113 is accurate to 6 decimal places with only a 3-digit denominator
Building pi's continued fraction: each convergent zooms in closer
π 3/1 3.000 22/7 3.1428 333/106 3.1415 355/113 3.141592 ZOOM: 3.14150 to 3.14170 3.14150 3.14160 3.14170 pi = 3.14159265... 333/106 (under) 355/113 6 digits! 103993/33102 3/1 22/7 333/106 355/113 103993/33102 true pi

Each convergent alternates above and below pi. The denominators jump from 7 to 106 to 113, a tiny increase that buys enormous precision. The famous 355/113 is the most striking: a 3-digit denominator matching pi to 6 decimal places, better than any fraction with a smaller denominator.

Related topics
Phi Sqrt2 Khinchin
Key facts about Continued Fractions

Every real number has a unique continued fraction expansion. Rational numbers have finite expansions. Quadratic irrationals (like sqrt(2) and phi) have eventually periodic expansions. Transcendentals like pi have no pattern. The convergents of a continued fraction are the best rational approximations: 22/7 and 355/113 are convergents of pi, matching it to 2 and 6 decimal places respectively. Phi = [1; 1, 1, 1, ...] is the hardest number to approximate, making it the most irrational in a precise sense.

Used in
Mathematics
💻Computer Sci
Music
🌌Astronomy
Physics
Engineering
🧬Biology
📊Statistics
📈Finance
🎨Art
🏛Architecture
🔐Cryptography
Chemistry
🦉Philosophy
🗺Geography
🌿Ecology
Want to test your knowledge?
Question
What is the continued fraction of sqrt(2)?
tap · space
1 / 10