Answering just the first of your questions: “What tests would you apply to determine if this [sequence] is truly random?”

How about treating it as a time-series, and checking for auto-correlations? Here is some R code. First some test data (first 1000 digits):


Check the counts of each digit:

> table(digits)
0 1 2 3 4 5 6 7 8 9
93 116 103 102 93 97 94 95 101 106

Then turn it into a time-series, and run the Box-Pierce test:

d=as.ts( digits )

which tells me:

X-squared = 1.2449, df = 1, p-value = 0.2645

Typically you’d want the p-value to be under 0.05 to say there are auto-correlations.

Run acf(d) to see the auto-correlations. I’ve not included an image here as it is a dull chart, though it is curious that the biggest lags are at 11 and 22. Run acf(d,lag.max=40) to show that there is no peak at lag=33, and that it was just coincidence!

P.S. We could compare how well those 1000 digits of pi did, by doing the same tests on real random numbers.


This generates 1000 random digits, does the test, and repeats this 100 times.

> summary(probs)
Min. 1st Qu. Median Mean 3rd Qu. Max.
0.006725 0.226800 0.469300 0.467100 0.709900 0.969900
> sd(probs)
[1] 0.2904346

So our result was comfortably within the first standard deviation, and pi quacks like a random duck. (I used set.seed(1) if you want to reproduce those exact numbers.)

You are watching: Are the digits of $\pi$ statistically random?. Info created by GBee English Center selection and synthesis along with other related topics.