How Close a Fraction Can Get

Pick a number and how many terms to keep. The card on the left is the fraction the continued fraction gives you; the line under it searches every fraction with a smaller denominator and reports the closest one it can find.

Loading interactive simulation...

The best fraction of its size, searched for rather than asserted 🖖

Set √2 and four terms and the tool hands back 17/12. Then it does the part worth having a tool for: it takes every denominator below 12, finds the nearest numerator for each, and reports the closest fraction it can build. That is 7/5, and it is 5.8 times further from √2 than 17/12. Truncating a continued fraction does not merely give a good fraction — it gives the best one available at that size, and the page would rather show you the search than name the theorem. Press The 355/113 surprise and the same sweep runs over every denominator up to 112. The best of them is 333/106, which is 312 times further out.

A large term means the fraction before it was already very good 🖖

π is [3; 7, 15, 1, 292, 1, 1, …], and the 292 is the one to look at. A large term means the leftover at that point was very nearly nothing, which is another way of saying the fraction you were already holding was very nearly exact. So 355/113, the convergent immediately before it, gets seven significant figures out of a three-digit denominator, while 22/7, which is followed by a mere 15, manages three. The size of the next term is what tells you how good the fraction in your hand already is. It is also why 355/113 was worth finding in fifth-century China and is still the fraction anyone reaches for.

The golden ratio is the hardest number to approximate, and that is a measurement 🖖

Multiply each error by the square of its denominator and fractions of different sizes become comparable. Do it for √2 and the column settles at 0.354. Do it for φ and it settles at 0.447 — and that number is 1/√5, which no irrational can stay above for ever. φ is the number that presses hardest against that ceiling, and the reason is sitting in its expansion: every term is 1, the smallest a term is allowed to be, so every convergent is the least possible improvement on the one before. Calling φ the most irrational number sounds like a flourish. It is a measurement, and this is the column it lives in.

Problem solved in full

  1. Showing 355/113 is the closest fraction to π with a denominator under 1000 7 steps

    Show that 355/113 is the closest fraction to π with a denominator under 1000, and find out how far its reign actually runs.

    1. Run the expansion first. π = [3; 7, 15, 1, 292, …], so the convergents are 3, then 22/7, then 333/106, then 355/113.

    2. Each convergent comes from the two before it: multiply by the new term and add the one further back. Nothing in that step needs π itself, only its terms.

    3. 355/113 comes out at 3.1415929204 against π's 3.1415926536. The error is 2.7 × 10⁻⁷, which is seven significant figures from three digits over three digits.

    4. Now the search. Take every denominator from 1 to 112, pick the nearest numerator for each, and keep the closest result. The winner is 333/106, out by 8.3 × 10⁻⁵ — 312 times further than 355/113.

    5. Widen the search to 1000 and nothing new appears. 355/113 is still the closest fraction there is.

    6. So how far does it hold? Sweeping upward, the first fraction that beats it is 52163/16604. That means 355/113 is the closest fraction to π for every denominator up to 16,603.

    7. And look at what beating it buys. 52163/16604 has a denominator 147 times larger and reduces the error by 0.2%. That is the shape of the whole subject: the good fractions are enormously better than their neighbours, and the next real improvement is a long way up.

    Answer

    355/113, out by 2.7 × 10⁻⁷, and the closest fraction to π for every denominator up to 16,603. Where this stops is the part worth knowing. √2 runs 2, 2, 2, … for ever and e runs 1, 1, 2, 1, 1, 4, 1, 1, 6, …, so both patterns can be stated and proved. Nobody knows a pattern in π's terms. Nobody knows whether they stay bounded, or whether some vast term is waiting further out and with it a fraction far better than 355/113. The 292 is not explained by anything. It is simply what π does.

Learning path

Writing a number down

Leads to Rounding the best fraction of a given size, searched for rather than asserted.

Example problems

  • √2 in four terms - √2 is [1; 2, 2, 2, …], and stopping after four terms gives 17/12. Every fraction with a denominator below 12 is further away; the nearest of them, 7/5, is 5.8 times further out.
  • The 355/113 surprise - 355/113 agrees with π to seven significant figures, from three digits over three digits. The closest fraction with any smaller denominator is 333/106, which is 312 times further away.
  • The hardest number to approximate - φ is [1; 1, 1, 1, …], and every term being the smallest a term can be is exactly what makes it the worst-approximable number there is. q² × error settles at 0.447, which is 1/√5, the highest value any irrational can settle on.
  • e keeps a pattern - e is [2; 1, 2, 1, 1, 4, 1, 1, 6, …] — the 1, 1, even-number pattern runs for ever. An expansion that never terminates is what irrational means, so the pattern is itself the proof that e is not a fraction.