Decimal Expansion of Pi: Interesting Observations, Part II

Completion run length_ control comparison

Last month’s post focused on decimal expansion of pi – the all-important mathematical constant which has fascinated mathematicians for centuries and caused many-a-rhapsody on the beauty of nature (fill in the rest). The number has been computed through 1 billionth digit of precision (and probably beyond) and saved in text file here:

Question: is pi random? As you probably can figure out from last month’s post – it didn’t seem so. The approach was, take pi sequence 3, 1, 4, 1 etc and create a sequence of completion runs. Each completion run happens once you’ve read all digits from 0 to 9 at least once. For every sequence of digits from 0 to 9, there is a corresponding sequence of completion runs. Last month’s study focused on first million digits of pi – this month it’s one billion. In the previous study, I structured the problem as if there were two sequences running in parallel: one is the sequence of pi digits, the other is a sequence of completely random digits. Both sequences are read in parallel, and completion run lengths are recorded as we progress through the sequence. The question is: can we discern if there are any anomalous-non-random behavior in decimal expansion of pi through data on completion runs? We already saw that for the first 1,000,000 digits of pi, there seemed to be a few more ‘abnormally’ long completion runs as compared with a corresponding control ‘random’ sequence. The ‘random’ property is of course questionable due to pseudo-random number generation. This, in fact, puts the whole approach into question as the ‘randomness’ is established using a pseudo-random numbers but that is a limitation will have to accept.

So, this month, I show the completion run length distribution for the first billion digits of pi and compare it with the same distribution for billion-length sequences obtained using rand() function in C – which is supposed to be ‘fairly’ random. In fact, I ran the random control twice but using the same random number generator with a different seed. Results are in the table. Completion run lengths are stratified by intervals of 10 and the count of runs in each interval is compared for pi and one of the random controls. Each frequency for pi is compared with the corresponding frequency for control.

There seems to be something interesting with respect to sign of the difference. In particular, when comparing the count of completion runs grouped into buckets of 10, the pi counts are higher than those coming from random controls. The two random controls (both obtained using rand() function in C standard library with different seed value) are predictably in agreement with each other. This is easy to spot just by looking at the count of completion runs for pi’s billion – 34,140,378 and compare that with the first control 34,135,390. If the random generator is indeed reliable, this would mean that pi has 4,988 more completion runs than a corresponding purely random sequence. Now, let’s generate another random sequence (control 2) and compare control 1 with control 2 to see the difference between completion runs. Well, it’s only 1,559. And, when comparing the distributions, there is a lot more uniformity between length buckets. Control 1 is higher than control 2 in 8 buckets and is lower than control 2 in 8 buckets for the total of no bucket-wise differences. But for pi, the situation is quite different, when compared with both control 1 and control 2. Pi seems to be higher than control 1 in 6 buckets (net) and higher than control 2 in 5 buckets. So, not only the overall count of completion runs is higher for pi, but the distribution of the run lengths is different.

Clearly something is going on either with pi or with the random number generator. Richard Feynman (whose name already showed up on this blog before) once spotted a sequence of six 9s pretty early in the decimal expansion of pi (at 762nd position), and it was called Feynman point.


~ by Monsi.Terdex on February 1, 2014.

2 Responses to “Decimal Expansion of Pi: Interesting Observations, Part II”

  1. Hey there,
    Very useful post! I would like to invite you to visit my blog as well, and read my latest post about sequence points in C and C++.

    Best regards,

    • Panqnik,

      Thanks – looks like you just started the blog, I’ll be visiting every now and then. My orientation is mostly scientific/analytical, not pure programming though.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Normal Boy

Nothing out of the ordinary

Data Engineering Blog

Compare different philosophies, approaches and tools for Analytics.

%d bloggers like this: