An infinite number you can compute

π is the ratio of a circle's circumference to its diameter: 3.14159… Its digits go on forever and never settle into a pattern (π is irrational, in fact transcendental). That sounds like the ultimate hard problem — an answer with infinitely many digits.

And yet computing π is, in the language of this site, solved and efficient. You can write a program in a handful of lines that prints as many correct digits as you have patience for. The infinitude isn't the obstacle; you simply ask for n digits and the algorithm delivers them. The interesting questions are: how fast do the digits come, and what does it take to reach a trillion of them?

π is the perfect example of a problem that sounds impossible (infinite output!) but is actually a story about algorithmic efficiency and engineering — not undecidability.

Compute π yourself

Here are two classic infinite series for π. The Leibniz series is famous and dead simple — but painfully slow: it needs hundreds of terms just to pin down two decimals. The Nilakantha series (15th-century India) converges far faster from the same idea. Drag the slider and watch each estimate crawl, then sprint, toward 3.14159…

<p class="hint">{{hint}}</p>
<label class="slabel">{{terms}}: <b id="nval">50</b></label>
<input id="terms" type="range" min="1" max="2000" value="50" class="slider" />
<div class="rows">
  <div class="row">
    <span class="name">Leibniz</span>
    <span class="val" id="leib">—</span>
    <span class="acc" id="leibAcc"></span>
  </div>
  <div class="row">
    <span class="name">Nilakantha</span>
    <span class="val" id="nila">—</span>
    <span class="acc" id="nilaAcc"></span>
  </div>
  <div class="row truth">
    <span class="name">{{pi_true}}</span>
    <span class="val">3.14159265358979</span>
    <span class="acc"></span>
  </div>
</div>
/* {{css_note}} */
* { box-sizing: border-box; }
.hint { font-size: 14px; color: #556; line-height: 1.5; }
.slabel { display: block; font-size: 14px; margin: 12px 0 4px; color: #334; }
.slider { width: 100%; }
.rows { margin-top: 18px; font-family: 'JetBrains Mono', ui-monospace, monospace; }
.row {
  display: grid; grid-template-columns: 110px 1fr auto; align-items: baseline;
  gap: 10px; padding: 8px 10px; border-radius: 8px; background: #f3f5f8; margin-bottom: 6px;
}
.row.truth { background: #e1f5ee; }
.name { font-weight: 700; color: #1f6feb; }
.truth .name { color: #0f6e56; }
.val { font-size: 18px; letter-spacing: .3px; color: #223; white-space: nowrap; overflow: hidden; }
.acc { font-size: 12px; color: #0f6e56; font-weight: 600; }
// Code not found

This is the whole lesson in one widget: both algorithms are correct, but one is wildly more efficient. Choosing the right series is the difference between two digits and two billion.

The hard part

If π is solved, where's the difficulty? In how fast each correct digit arrives, and how much memory and arithmetic it costs at scale.

  • Slow series. Leibniz adds roughly one correct digit per ten times more terms. To get 10 digits you'd need ~10 billion terms — hopeless.

  • Fast series. The Chudnovsky formula adds about 14 digits per term. Every modern π record (now in the tens of trillions of digits) uses it, paired with fast "big number" multiplication (FFT-based), because multiplying million-digit numbers is itself the bottleneck.

  • The magic trick — BBP. The Bailey–Borwein–Plouffe formula (1995) can compute the n-th hexadecimal digit of π without computing any of the previous ones. That shattered the intuition that you must grind through every digit in order.

So π lives firmly in P — polynomial, efficient, solved. Its records are won not by escaping a complexity wall (there isn't one) but by better series, better big-number arithmetic, and weeks of carefully managed disk and RAM. It's an engineering marathon, not a theoretical impossibility.

Where it matters

Computing π to absurd precision is partly sport, but the machinery behind it is serious:

  • Hardware stress tests. π computations push CPU, memory and disk to their limits for days; they're a classic way to validate new supercomputers and find faults.

  • Arbitrary-precision arithmetic. The fast-multiplication algorithms (Karatsuba, FFT/NTT) developed and tuned for π power cryptography, computer algebra systems and scientific computing.

  • Numerical reality. Ironically, physics and engineering never need more than ~15 digits — NASA uses about 15 to navigate spacecraft. The digit hunt is about the algorithms, not the value.

π also reappears in surprising places — including a "Monte Carlo" method where random points dropped in a square estimate π from the fraction that land inside a circle, tying this article to probability and randomized algorithms elsewhere on kipu.

Infinite, but tractable

π teaches a subtle and freeing lesson: an answer with infinitely many digits is not automatically a hard problem. The output is unbounded, but the work per digit is small and well understood. The whole drama is efficiency — Leibniz vs. Nilakantha vs. Chudnovsky — and the engineering of doing arithmetic on numbers with trillions of digits.

That makes π a bright counterpoint to the genuinely hard problems on kipu. Not everything infinite is intractable; sometimes "forever" is just a slider you can drag.

Share this article

Pick a channel — or use your device's native share sheet.

Comments

Loading comments...

https://www.kipuhub.com/en/article/pi/Content licensed under CC BY-NC 4.0.