​

Randomness of Pi
Test for randomness in the digits of π.

Run the code to find the numerical value of π to 50 digits. Try getting more than 50 digits—for example, 1,000:
1.

N[Pi,
50
]
In[]:=
Get a list of the first 100 digits of π in base 10. Try bases other than 10—for example, 2:
2.

First[RealDigits[Pi,
10
,100]]
In[]:=
Count how often 0 through 9 occur in the first 100 digits. Try more digits than 100:
3.

Counts[First[RealDigits[Pi,10,
100
]]]
In[]:=
Make a bar chart of 0 through 9 frequencies. See if it evens out with more than 100 digits:
4.

BarChart[KeySort[Counts[First[RealDigits[Pi,10,
100
]]]]]
In[]:=
Make a 20×20 array of π digits. Try sizes other than 20—for example, 40:
5.

Grid[With[{n=
20
},Partition[First[RealDigits[Pi,10,n*n]],n]]]
In[]:=
Visualize the array of digits. Try a larger array than 20×20:
6.

ArrayPlot[With[{n=
20
},Partition[First[RealDigits[Pi,10,n*n]],n]]]
In[]:=
​