A colorful π chart

It’s the 14th day of the 3rd month of the year. Which means it’s pi day today! Pi, that really long number with the weird symbol π that you learned about in school because it had something to do with circles. To remind ourselves: The circumference of a circle is π times bigger than its diameter – or, to give the first hundred numbers of pi some space,

3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679...

times bigger. By now, 31 trillion decimal places of pi are known (not that we’d need that many, but you know, it’s nice to break records). The chart above shows the first 10,000.

It shows how often each number between 0 and 9 appears. As we can see, they don’t reach an equal share yet in these first 10,000 digits. In fact, that happens surprisingly late: Of an astonishing 10 million pi digits, the number 4 makes up 10.011% of them and the number 1 “only” 9.993%. Here we can see how the shares become more equal with every magnitude:

Getting the numbers

Maybe you wonder how I got the numbers for the first chart. The pi digits are known (e.g. here), but how did I find out the distribution of numbers for the first 1000 digits, the first 1001 digits, the first 1002 digits, etc.?

It’s a simple Excel formula! (I was really happy when I realized it’s possible to do this with Excel; I wouldn’t have wanted to unpack R for this…) Here it is:
=100/1002*((LEN(LEFT(A1,1002)))-LEN(SUBSTITUTE(LEFT(A1,1002),"0","")))

This formula tells us the share of zeros in the first 1002 digits of pi, assuming that we put our pi digits in cell A1. Try it yourself, or copy my spreadsheet with numbers between 100 and 10,000 digits.


If you don’t have enough of pi charts yet, visit data visualization designer Nadieh Bremer’s wonderful 2015 project “Exploring the art hidden in π” (and an animation of it here) or this Guardian article published on pi day 2014. Next week, I’ll finally tell you about these ngram numbers I promised you for this week. See you then!

Comments