Computing the trillionth digit of π without touching the trillion minus one digits before it sounds like a paradox. Pi is irrational, so its digits never repeat or terminate, and every ordinary method earns each digit by computing all the ones ahead of it. Spigot-style algorithms break that rule, and the mathematics doing the work is simpler than the result suggests.
The trending query A faster algorithm for extracting hexadecimal digits of π appeared on the Hacker News front page in late November 2026, which is why it earns a closer read here. The durable content sits in number theory: how one series identity plus modular arithmetic can jump straight to digit n. The spike fades, and the mechanism stays useful long after.
Why digits normally cost their weight in predecessors
Any full-precision computation of π, from Machin's arctangent formulas to the Chudnovsky series behind recent record runs, produces its digits in order. To know digit n exactly, the computation must carry enough precision to rule out rounding contamination from every earlier position, so memory and time both grow with n.
The ordering feels unavoidable because the digits behave like a random sequence in every statistical test applied to them, with no exploitable pattern for a shortcut to bite into. Randomness, though, is an observation about the tests so far. No proof settles it, which is exactly why a formula that skips ahead is not contradicting any known structure.
The spigot trick, step by step
The best-known extraction identity was published by David Bailey, Peter Borwein and Simon Plouffe in 1995, and it works in base 16, where powers of two make the modular reduction clean. The formula expresses π as a sum of terms that shrink geometrically, so terms well before position n contribute nothing at that depth, and terms after it start below the rounding floor.
The heavy lifting is modular arithmetic, the arithmetic of remainders: instead of computing 16 to the n, a number with digits stacked to the horizon, the algorithm computes 16 to the n modulo a small power of 16, keeping every intermediate value tiny. Modular exponentiation squares and multiplies through the bits of the exponent, which keeps the cost close to logarithmic in n.
- Choose the digit position n you want to read.
- Split the series for π into terms that matter at position n and terms that fall below it.
- Reduce the distant-tail terms with modular exponentiation: compute 16 to the power in question modulo a small power of 16.
- Sum the surviving fractional parts and discard everything above the units digit.
- Multiply the fractional part by 16 and read off the leading digit.
Drop in your PDF - it doesn't leave your device.
Every miss becomes a red node on your map.
Free plan: 21 nodes, no card, no countdown.
When spigots win, and what they win at
In bulk, digit extraction loses: computing every digit up to N this way costs far more than a full-precision run. For one digit, or a handful, at some deep position, nothing else competes, because the cost grows only logarithmically with how far out you reach.
The practical payoff is verification. Record computations of π are cross-checked by extracting a few digits at deep positions with methods independent of the main run, so a bug anywhere in the pipeline surfaces as a mismatch at a known offset. The philosophical footnote stands alongside: the digits pass every statistical randomness test thrown at them, and no proof settles whether they truly behave like random numbers.
| Approach | What it yields | Where it wins |
|---|---|---|
| Arctangent series (Machin) | All digits in order | Historic hand computation |
| Chudnovsky series | All digits in order, fastest in bulk | Record runs |
| Digit extraction (BBP-style) | Chosen digits at position n | Spot checks and independent verification |
Key takeaways
- Pi is irrational: its digits never repeat or terminate, and ordinary methods must compute every digit before n to reach n.
- Digit-extraction algorithms jump near position n directly, using modular arithmetic and series identities, and base 16 keeps the reductions clean.
- The BBP formula, published by Bailey, Borwein and Plouffe in 1995, made hexadecimal digit extraction practical.
- Spigots lose in bulk but win for single far digits, which makes them ideal for verifying record computations independently.
- Pi's digits pass every statistical randomness test applied so far, while randomness itself remains unproven.
Quick answers
Can you compute one digit of π alone?
Yes, in hexadecimal, with digit-extraction algorithms built on modular arithmetic.
What does hexadecimal mean?
Base 16, written with 0 to 9 and A to F, where powers of two keep the modular reductions clean.
What is modular arithmetic?
Arithmetic on remainders: values are reduced modulo a chosen number, which keeps intermediate results small.
Do record computations use this?
Records use full-precision series for bulk digits, then extract a few deep digits independently as a cross-check.
Are pi's digits random?
They pass every statistical test applied, but no proof settles the question, so it stays open.
One thing to do tonight
Look up the BBP formula and trace a single term of its series by hand for n equal to 1, including the modular reduction. One pass through the arithmetic makes the skip-ahead idea concrete in a way no summary can.