← Research

How Normal Is Pi?

Testing one million digits of mathematical constants for statistical randomness

2026-04-10 Mathematics Statistics

Is π random? Not in the mathematical sense — π is completely determined — but in a statistical sense: do its digits look random? Does every digit appear equally often? Does every pair? Every triple? Is there any hidden structure, any pattern that would let you predict the next digit from the ones before it?

A number whose digits pass every such test is called normal. In a normal number, every finite sequence of digits appears with exactly the frequency you'd expect from rolling a fair ten-sided die. The digit 7 appears 10% of the time. The pair 42 appears 1% of the time. The sequence 314159 appears once in every million digits, on average.

π is conjectured to be normal. So is e, √2, and ln(2). But despite centuries of effort, not one of these conjectures has been proven. We know normal numbers exist — almost all real numbers are normal — yet we cannot prove that any specific “natural” constant is one of them.

So I did the next best thing: I computed one million digits of each constant and subjected them to a battery of statistical tests. The question isn't whether they are normal — that would require infinitely many digits — but whether, in the first million digits, any of them show detectable deviations from randomness.

The Digit Census

The most basic test: count how often each digit appears. In a perfectly normal number, each digit 0–9 would appear exactly 10% of the time. With one million digits, that's 100,000 of each. How close do our constants come?

Digit Frequency
Deviation from the expected 10% for each digit

The deviations are tiny — fractions of a percent. The chi-squared test formalises this: it measures how much the observed frequencies deviate from expectation, accounting for the number of digits. A z-score near zero means the digits look random. A z-score above 2 or below −2 would be suspicious. All four constants pass comfortably.

Watching Randomness Emerge

Something beautiful happens when you track digit frequencies as you read more and more digits. At first, the frequencies swing wildly — the first few digits of π are 3, 1, 4, 1, 5, giving digits 1 and 4 a huge overrepresentation and most digits zero counts. But as the sample grows, the frequencies converge toward 10%.

How fast? Drag the slider below to watch the convergence in real time.

Frequency Convergence
How digit frequencies stabilise as sample size grows
1,000,000

The Pair Matrix

Single-digit frequencies test whether π is simply normal in base 10. But full normality requires more: every pair of consecutive digits must also appear with equal frequency (1% each for the 100 possible pairs), every triple (0.1% each for 1000 triples), and so on.

The heatmap below shows the pair frequencies as a 10×10 matrix. In a perfectly normal number, every cell would be the same shade. Deviations show up as lighter (overrepresented) or darker (underrepresented) cells.

Pair Frequency Heatmap
Each cell shows how often digit X is followed by digit Y

The Scoreboard

How do the constants compare to each other — and to a pseudorandom baseline? The table below shows the z-score from the chi-squared test at three scales: single digits (10 categories), pairs (100 categories), and triples (1000 categories). A z-score between −2 and +2 is considered normal.

Normality Scoreboard
Constant 1-Digit z 2-Digit z Lag-1 Corr. Max Run Verdict

The Convergence of Randomness

The chi-squared z-score measures how “suspicious” a digit sequence looks at a given length. As we read more digits, the z-score should stay near zero if the constant is behaving normally. The chart below tracks this convergence for all five sequences simultaneously.

Chi-Squared Z-Score vs. Sample Size
Single-digit frequencies tested at increasing depths

All five curves stay within the ±2 band (grey zone), confirming that none of our constants shows systematic deviation from randomness at any scale up to one million digits. The curves wander like random walks — which is exactly what they should do if the digits are behaving normally.

The Feynman Point

At position 762 in π's decimal expansion, something curious happens: six consecutive 9s appear. This is the famous Feynman Point, named after the physicist who allegedly said he wanted to memorise π up to that point so he could recite it and end with “...nine nine nine nine nine nine, and so on” — as though π were rational.

Is this surprising? In a random sequence, the expected position of the first run of six identical digits is around position 555,556 (since the probability of any specific six-digit run is 10−5 at each position). Finding six 9s at position 762 is remarkably early — but not impossibly so. It's the kind of coincidence that happens somewhere in every sufficiently long random sequence.

The Feynman Point & Digit Explorer
First 10,000 digits of each constant, colour-coded by digit

Longest Runs

The longest run of a single repeated digit tells us about the tail behaviour of the sequence. In one million random digits, the expected longest run of any single digit is about 6–7 (since runs of length k of a specific digit occur with probability 0.1k).

Longest Runs Comparison

All constants produce longest runs in the 6–8 range — exactly what we'd expect from random sequences. No constant stands out as having suspiciously long or short runs.

Serial Correlation

If consecutive digits were correlated — if knowing one digit gave you information about the next — that would be a clear violation of normality. The serial correlation coefficient measures this: a value of 0 means no correlation, while ±1 would mean perfect prediction.

Serial Correlation at Various Lags
How correlated is each digit with the digit k positions later?

The correlations are vanishingly small — on the order of 10−3 — at every lag and for every constant. The digits of π are as uncorrelated with each other as the output of a pseudorandom number generator.

The Verdict

After subjecting one million digits of π, e, √2, and ln(2) to a battery of statistical tests — digit frequencies, pair frequencies, triple frequencies, run lengths, serial correlations, gap tests, and poker tests — the answer is clear:

In the first one million digits, π is statistically indistinguishable from a random sequence. So are e, √2, and ln(2). None shows any detectable deviation from normality.

This doesn't prove normality — no finite computation ever could. A number could look perfectly normal in its first trillion digits and then switch to all 7s forever. But the empirical evidence is overwhelming: these constants behave exactly as normal numbers should.

What makes this remarkable is the contrast between what we can measure and what we can prove. We've checked π's digits to trillions of decimal places and found no deviation from normality. Yet the proof that π is normal — a proof that almost certainly exists, given that almost every real number is normal — continues to elude mathematics. The digits of π are hiding their secret in plain sight: a million digits that look perfectly random, generated by a formula that is perfectly deterministic.

Methodology: One million digits of each constant computed using mpmath (arbitrary-precision arithmetic). Statistical tests: chi-squared goodness-of-fit for n-gram frequencies, Wald-Wolfowitz runs test, serial correlation, poker test (5-digit groupings), gap test. Pseudorandom baseline generated with Python's Mersenne Twister (seed 42). All analysis code and raw data available in the project repository.