All Chapters

The Missing Chapter

The Number That Fakes Randomness

Pi is the most famous number in mathematics. It is also, digit by digit, indistinguishable from noise.

An extension of Jordan Ellenberg's "How Not to Be Wrong"

Chapter 1

The Most Boring Interesting Number

In 1995, Yasumasa Kanada's laboratory in Tokyo computed pi to 6.4 billion decimal places. Reporters asked what he'd found. His answer was deflating: "Nothing." No pattern, no repetition, no hidden structure. Just digits — an endless, formless stream of digits that looked, for all the world, like somebody had rolled a ten-sided die 6.4 billion times.1

This is the central paradox of pi. It is the most determined number in all of mathematics — the ratio of any circle's circumference to its diameter, fixed since before the universe had circles in it. There's nothing uncertain about pi. You can compute its billionth digit the same way you can compute its first: by patient, exact arithmetic. And yet the output of that arithmetic looks random. Perfectly, stubbornly, inscrutably random.

Here is a number that is the opposite of a secret — its definition fits on an index card — yet its decimal expansion behaves as if it were generated by a process with no memory, no structure, and no plan. Pi is a paradox made of digits.

That paradox isn't just a curiosity. It reaches into the deepest questions mathematics can ask: What does it mean for a sequence to be "random"? Can a deterministic process produce genuine disorder? And when we look at a string of numbers and see no pattern, is that because there's no pattern there — or because we're not clever enough to find it?

π = 3.14159265358979323846 2643383279502884197... 1693993751058209749... 4459230781640628620...

Pi: a perfectly known number whose digits look perfectly unknown

Chapter 2

What "Random" Means (and Doesn't)

Before we can say whether pi's digits are random, we need to be honest about what "random" means — and here mathematics splits into at least three different camps, each with its own definition, its own standards of evidence, and its own philosophical baggage.

The first notion is statistical randomness. A sequence is statistically random if it passes a battery of tests: each digit appears roughly equally often, each pair of consecutive digits appears with roughly equal frequency, there are no long runs of the same digit beyond what chance would predict, and so on. By this standard, pi's digits look superb. In the first 10 billion digits, each of the digits 0 through 9 shows up almost exactly one billion times.2 If you ran the standard tests — frequency analysis, serial correlation, the runs test, the spectral test — pi passes them all with flying colors.

Digit Frequency in Pi

Frequency of each digit in the first 1,000 digits of π. Move the slider to see how the distribution evens out.

Digits of π 1,000
Max deviation from expected 10%

The second notion is normality. A number is normal in base 10 if every string of digits appears with the frequency you'd expect from a uniform distribution. Not just single digits — every pair, every triple, every hundred-digit sequence. Being normal is a much stronger property than passing the basic frequency test. It says that pi's digits contain every phone number, every birthday, the complete works of Shakespeare encoded in ASCII, your Social Security number, and the winning lottery numbers for every future drawing — all infinitely many times.3

Nobody has proved that pi is normal. This is one of the great embarrassments of modern mathematics: we have computed pi to a hundred trillion digits, and every statistical test we throw at it says "yes, this looks normal," but we cannot prove it. We cannot prove it for e, or for √2, or for log 2, or for essentially any number that anyone actually cares about. We know that almost all real numbers are normal — in the measure-theoretic sense, the non-normal numbers form a set of measure zero — and yet we can barely exhibit a single natural example.4

Almost every number is normal. We just can't prove it about any number we can name.

The third notion is algorithmic randomness, due to Kolmogorov and Chaitin. A sequence is algorithmically random if it can't be produced by a program shorter than the sequence itself. By this definition, pi is emphatically not random. You can write a program in a few dozen lines that will spit out pi's digits forever. The entire infinite sequence is compressed into a tiny algorithm. From Kolmogorov's perspective, pi has extremely low complexity — it's about as non-random as an infinite sequence can be.5

Statistically random: Passes frequency and correlation tests. Pi: ✓ (as far as we've checked)

Normal: Every finite string appears with expected frequency. Pi: Probably, but unproven

Algorithmically random: Incompressible — no short program can generate it. Pi: ✗ (definitely not)

So which is it? Is pi random or isn't it? The answer, of course, is that the question is wrong. Pi is a fixed, determined mathematical constant. It isn't "random" in the way a coin flip is random. What's remarkable is that the digits it produces — by a fully deterministic process — are indistinguishable from randomness by any statistical test we know.

Chapter 3

Looking for Yourself in Pi

If pi is normal, then your birthday is in there — not once, but infinitely many times. So is your phone number. So is every sentence in this essay, encoded in decimal. This sounds like mysticism, but it's just a consequence of the definition: in a normal number, every finite string of digits appears with the frequency dictated by chance.

The catch is the word "finite." Pi contains every finite pattern, but it doesn't contain every infinite pattern. It doesn't contain the decimal expansion of, say, 1/3 = 0.333... as a contiguous substring, because that would require an infinite run of 3s, which would violate the frequency requirements for other digits. Pi contains everything — but only in small doses.

Find a String in Pi

Search for any digit sequence in the first 100,000 digits of π. Try your birthday (e.g., 031495) or phone number.

This is not an abstract point. In 2005, an engineer at Google put up a billboard on Highway 101 in Silicon Valley. It read: "{first 10-digit prime found in consecutive digits of e}.com". The answer — 7427466391 — led to a webpage with another puzzle, which led to another, which eventually led to a job application form.6 Google was banking on the fact that mathematical constants contain interesting patterns if you look hard enough — or perhaps more precisely, they were banking on the fact that the definition of "interesting" is flexible enough that you can always find what you're looking for.

And this is the real lesson. The claim "I found my birthday in pi!" is not evidence that pi is in any way connected to you, any more than finding a face in the clouds is evidence that the sky is thinking about you. When a sequence has enough digits, every short pattern appears. The surprising thing would be if your birthday weren't there. What pi teaches you about randomness is the same thing that clouds teach you about pattern recognition: our brains are wired to find meaning, and the universe is generous enough — or cruel enough — to keep supplying things that look meaningful.

3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0 2 8 8 4 1 9 7 1 6 9 3 9 9 26535 38327 1 0 5 8 2 0 9 7 4 9 4 4 5 9 2 3 0 7 8 1 6 4 0 6 2 8 6 2 0 8 9 9 8 6 2 8 0 3 4 8 2 5 3 4 2 1 999 Every finite pattern appears — eventually

In a normal number, every substring you search for will appear — your birthday, your phone number, any sequence at all

Chapter 4

The Monkey and the Typewriter

You've heard the thought experiment: a monkey typing at random will eventually produce the complete works of Shakespeare. What you may not have heard is how long "eventually" is. If our monkey types one character per second, chosen uniformly from an alphabet of 27 characters (letters plus space), the expected time to produce just the phrase "to be or not to be" — 18 characters — is about 2718 seconds, which is roughly 1018 years. The universe is about 1.4 × 1010 years old. Our monkey would need roughly a hundred million universes.7

But here's the thing: it would happen. And in pi — if pi is normal — it already has happened. The digits of pi, read as groups of two digits, can be interpreted as letters (01 = A, 02 = B, ..., 26 = Z, 00 = space). Somewhere in that vast decimal expansion, the phrase "TO BE OR NOT TO BE" appears. Somewhere further along, the entire text of Hamlet appears. And further still, a version of Hamlet with one typo. And then another version with a different typo. And on and on forever.8

This is beautiful and also completely useless. Finding Shakespeare in pi is like finding a needle in a haystack the size of the observable universe — cubed. You know it's there, but knowing doesn't help you get to it. The address of the passage (the position in pi where it starts) would be a number so astronomically large that writing it down would require more atoms than exist. Information is only useful if you can access it.

The Librarian's Dilemma

Borges imagined a Library of Babel containing every possible 410-page book. Such a library would contain all knowledge — but it would also be completely useless, because finding the one true book among the nonsense is as hard as writing it from scratch. Pi is the mathematical Library of Babel: it contains everything, and therefore tells you nothing.

Chapter 5

The Feynman Point and Other Accidents

At position 762 in the decimal expansion of pi, something weird happens: the digit 9 appears six times in a row. This is the famous "Feynman point," supposedly named because Richard Feynman once joked that he wanted to memorize pi up to that point and then say "...nine nine nine nine nine nine, and so on," implying that pi eventually becomes all nines.9

Is the Feynman point surprising? That depends on what you mean. Six consecutive identical digits in the first 800 decimal places: that feels like it should be rare, and it is — the probability of seeing a run of six identical digits in a random 800-digit sequence is about 0.1%. But pi has an infinite decimal expansion, and in an infinite sequence, everything that can happen will happen. The Feynman point isn't evidence that pi is unusual; it's evidence that humans are very good at scanning long sequences and flagging the parts that look strange.

Psychologists call this the clustering illusion — our tendency to perceive patterns in random data. Amos Tversky and Daniel Kahneman demonstrated this in their famous study of basketball "hot streaks": fans watching a player make three shots in a row perceived a hot hand, but statistical analysis showed the sequences were consistent with independent random events.10 We do the same thing with pi. We scan the digits, find something that looks anomalous, and feel certain it must mean something.

It doesn't. Or rather, what it means is: this is what randomness looks like. Randomness is clumpy. It has streaks. It has weird coincidences. A truly random sequence with no streaks or clusters would, paradoxically, not be random at all — the lack of clustering would itself be a pattern.

...49951 05973 17328 16096 31859 50244 59455 34690 67324 99999 98372 97804 99510 59731 73281 60963 The Feynman Point Position 762–767

Six consecutive 9s at position 762 — improbable locally, inevitable globally

Chapter 6

Why We Can't Prove It

The normality of pi is one of those problems that seems like it should be easy. After all, we have a formula for pi. We have hundreds of formulas for pi. The Bailey–Borwein–Plouffe formula, discovered in 1995, can compute any individual hexadecimal digit of pi without computing all the preceding digits — a feat that seemed impossible before it was done.11 If we can reach any digit of pi directly, why can't we prove something about the distribution of all the digits?

The answer is that computing digits and understanding their distribution are fundamentally different problems. To prove normality, you'd need to show that the digits satisfy an equidistribution property: that the sequence (10n × π) mod 1 is uniformly distributed on [0,1]. By Weyl's theorem, this happens if and only if certain exponential sums over the digits grow slower than the number of terms.12 But bounding those exponential sums requires deep knowledge of the arithmetic structure of pi, and despite centuries of effort, that structure remains largely opaque.

We know pi is irrational (Lambert proved this in 1761). We know pi is transcendental (Lindemann proved this in 1882, settling the ancient problem of squaring the circle). But irrationality and transcendence are algebraic properties — they tell you that pi can't be expressed as a ratio of integers or as the root of a polynomial with integer coefficients. Normality is a metric property — it's about the statistical distribution of digits. And these two types of properties live in different mathematical worlds. Knowing one tells you almost nothing about the other.

The only numbers that have been proven normal are ones that were constructed to be normal. The most famous is Champernowne's constant: 0.12345678910111213141516... — you just concatenate all the natural numbers.13 This is normal by construction, but it's also boring. It's a number built to satisfy a definition, not a number that arises naturally in mathematics. The challenge — still wide open — is to prove normality for a number that shows up for reasons having nothing to do with normality.

Monte Carlo Pi Estimator

Drop random points in a square. The fraction landing inside the inscribed circle estimates π/4. Watch randomness produce pi — the reverse of our usual story.

Estimate of π
0 points dropped
Chapter 7

What Pi Teaches Us About Randomness

Here, then, is the lesson — and it's not about pi. Or not only about pi.

We live in a world that is, at every level, governed by deterministic or nearly deterministic processes. The weather follows the laws of fluid dynamics. The stock market follows the aggregate decisions of millions of rational-ish actors. Your DNA is a string of letters that was copied, with high fidelity, from your parents' DNA. And yet all of these systems look random. The weather is unpredictable past a few days. Stock prices follow a random walk. Genetic drift produces patterns indistinguishable from coin-flipping.

Pi tells us that determinism and randomness are not opposites. They are not even on the same axis. A process can be completely determined — every output a logical consequence of the rules — and yet produce output that no statistical test can distinguish from chance. The digits of pi are not random. But they perform randomness so convincingly that, for all practical purposes, the distinction doesn't matter.

This is the dirty secret of much of applied mathematics. When a physicist runs a Monte Carlo simulation, she uses a pseudorandom number generator — a deterministic algorithm that produces numbers that look random. Those numbers are no more random than the digits of pi. They pass the same statistical tests, and they fail the same Kolmogorov complexity test (they can be produced by a short program). But they work. They work beautifully. And the reason they work is that statistical randomness — the kind that matters for simulation, for modeling, for understanding the world — is about the pattern of the output, not the nature of the process that creates it.14

Ellenberg writes, in How Not to Be Wrong, that mathematics is the science of not being wrong. Here is one of its subtlest findings: you can be entirely right about how a number is generated and entirely surprised by what it looks like. You can know everything and predict nothing. The certainty of the formula and the chaos of the output coexist perfectly, each telling you something the other cannot.

Determinism and randomness are not opposites. Pi is proof.

So the next time someone tells you that the universe is either deterministic or random, as though those were the only two options and they were mutually exclusive, think of pi. Think of its digits — every one of them forced, every one of them fixed, and every one of them as unpredictable as a coin flip. The universe doesn't have to choose between order and chaos. It can have both. It already does.

Notes & References

  1. Kanada, Y. "New World Record of Pi: 6.4 Billion Decimal Digits." Department of Information Science, University of Tokyo, 1995. Kanada continued breaking his own records until 2002, reaching 1.24 trillion digits.
  2. Bailey, D. H., and Crandall, R. E. "On the Random Character of Fundamental Constant Expansions." Experimental Mathematics, Vol. 10, No. 2 (2001), pp. 175–190. The digit frequencies are remarkably close to uniform through billions of digits.
  3. This is true by the definition of normality, but only if pi is indeed normal. For a careful treatment, see Kuipers, L. and Niederreiter, H. Uniform Distribution of Sequences, Wiley, 1974.
  4. Borel, É. "Les probabilités dénombrables et leurs applications arithmétiques." Rendiconti del Circolo Matematico di Palermo, Vol. 27 (1909), pp. 247–271. Borel proved that almost all real numbers are normal, inaugurating the metric theory of numbers.
  5. Chaitin, G. J. "On the Length of Programs for Computing Finite Binary Sequences." Journal of the ACM, Vol. 13, No. 4 (1966), pp. 547–569. Kolmogorov independently developed similar ideas; see also Li, M. and Vitányi, P. An Introduction to Kolmogorov Complexity and Its Applications, 3rd ed., Springer, 2008.
  6. The Google billboard appeared in July 2004 along Highway 101 in Silicon Valley. The answer, 7427466391, is a 10-digit prime starting at position 101 in the decimal expansion of e.
  7. With 27 possible characters (letters plus space), the expected waiting time for any specific 18-character string is 2718 ≈ 1.13 × 1025.8 characters. At one per second, that's about 3.6 × 1017 years.
  8. This follows from normality in the appropriate base. If pi is normal in base 100, then every two-digit block appears uniformly, and any encoding of text into digit pairs will eventually appear. This remains unproven.
  9. The attribution to Feynman is somewhat apocryphal. The earliest print source appears to be Arndt, J. and Haenel, C. Pi — Unleashed, Springer, 2001.
  10. Gilovich, T., Vallone, R., and Tversky, A. "The Hot Hand in Basketball: On the Misperception of Random Sequences." Cognitive Psychology, Vol. 17, No. 3 (1985), pp. 295–314. (Though note that recent re-analyses by Miller and Sanjurjo (2018) found that the original study contained a subtle statistical bias, and that a modest hot-hand effect may in fact exist.)
  11. Bailey, D., Borwein, P., and Plouffe, S. "On the Rapid Computation of Various Polylogarithmic Constants." Mathematics of Computation, Vol. 66, No. 218 (1997), pp. 903–913.
  12. Weyl, H. "Über die Gleichverteilung von Zahlen mod. Eins." Mathematische Annalen, Vol. 77 (1916), pp. 313–352.
  13. Champernowne, D. G. "The Construction of Decimals Normal in the Scale of Ten." Journal of the London Mathematical Society, Vol. 8, No. 4 (1933), pp. 254–260.
  14. For an excellent survey of pseudorandom number generation and its mathematical foundations, see Knuth, D. E. The Art of Computer Programming, Vol. 2: Seminumerical Algorithms, 3rd ed., Addison-Wesley, 1997, Chapter 3.