### √-1 2^3 ∑ π...and it was delicious!

Today is a special day - Pi day. And also the international day of mathematics. For this reason we would like to present a small analysis of Pi. Get ready for some nice insights.

#### The Data

Instead of calculating the digit frequencies - due to effort minimisation - we used data from this website. We have made no effort to verify its accuracy. As the number in the file starts with 3. it was necessary to remove those two characters.

# opening the csv file in 'w+' mode
file = open('digi_list.csv', 'w+', newline ='')

# writing the data into the file
with file:
write = csv.writer(file)
write.writerows(pi_digit_billion)

As the data was read as string, a cast to int is performed:

pi_digit_billion_int = [ int(x) for x in pi_digit_billion) ]

#### The Distribution of Digits

Lets count the frequency, we can write our our function or use the Counter function from this package collections

def check_freq(x):
freq = {}
for c in set(x):
freq[c] = x.count(c)
return freq

or

Counter(pi_digit_billion_int)

It is suspected that π is a normal number, i.e. that its digits in any base are uniformly distributed in a certain precise sense. However, this has not been proven yet. But as it is shown in the result, the frequencies are pretty much balanced.

Counter({3: 99986912,
1: 99997334,
4: 100011958,
5: 99998885,
9: 100000273,
2: 100002410,
6: 100010387,
8: 100001839,
7: 99996061,
0: 99993942})

We can see that every digit occurs around 100'000'000 times. This and a chi-square test indicates this assumption as well. The uniformly distribution is also shown quite clearly in the histogram.

#### The Pie of Pi

What would be better suited  to visualise the distribution of pi than a pie chart? Let's see what it looks like with python. As the frequency is nearly identical, it's a perfect pie! So let's take this into account for designing it properly.