With a random normal distribution $\pi$ can be calculated with help of the PDF (probability density function). The method below apparently shows $\pi$ can be determined with random digits $[0,1,2,3,4,5,6,7,8,9]$. If this is correct and $\pi$ is a normal number (each digit frequency is equal) one could calculate $\pi$ from the digits of $\pi$ itself or any other normal number!

Not sure if the method is completely valid home brew by amateur and would like to know if I made big errors. Does anyone have links to similar methods (while I cannot find them) or more information?

$$f(x)={\frac {1}{\sigma {\sqrt {2\pi }}}}e^{-{\frac {1}{2}}\left({\frac {x-\bar{x}}{\sigma }}\right)^{2}} $$

The density at the mean value: $\bar{x}$ is equal to the front end of the PDF. This density at the mean can be approximated by a discrete distribution. Where $\bar{n}$ is the number of counted/observed values at the mean $\bar{x}$, $N$ is the sample size and $\Delta x$ is the distance between two discrete intervals.

$$f(\bar{x})=\frac {1}{\sigma {\sqrt {2\pi }}} \approx \frac{\bar{n}}{\Delta x N}$$

So if we are normal distributed set we can calculate $\pi$ with:

$$\boxed{\pi \approx \frac{1}{2} \cdot \left( \frac{\Delta x N}{ \bar{n} \sigma} \right)^{2}}$$

Let's create a simulation, we pick any digit from $[0,1,2,3,4,5,6,7,8,9]$ we take $s$ samples “with replacement”. The standard deviation of the mean can be calculated where: $a=0$, $b=9$ and $s$ sample size. A discrete uniform distribution:

$$\sigma=\sqrt{\frac{(b-a+1)^{2}-1}{12s}}$$

The distance between discrete intervals can be calculated with (found empirical):

$$\Delta x=\frac{1}{s}$$

Now we are set to do a simulation for example: take $s=800$ random samples from any of: $[0,1,2,3,4,5,6,7,8,9]$ (“with replacement” ) and determine the mean value. We repeat every sample with $N=150000$ trials, this is the number of sample means. From a single trial we can count how many samples are on the expected mean value: $\bar{x}=4.5$ (only if sample size is even). From these we can calculate the estimated $\pi$ a single time. We repeat every single trial $10000$ times so we can determine the mean of $\pi$.

*Left graph:*
All repeated trials, the gray dots are the random generated values. The blue line is the theoretical distribution.

*Middle graph:*
The mean counted observations $n$ at the expected value: $\bar{x}=4.5$. This gives a normal distribution, and the standard deviation of the mean count can be determined.

*Right graph:*
The value of $\pi$ determined by the boxed formula, note that the resulting distribution is not normal. The upper and lower bound $95\%$ is determined from the middle graph.

```
import numpy as np
import pandas as pd
#Samples, trials (pick trials >1000 to avoid zero counts) and repeats
samples=100
trials=2000
repeats=2000
#Set arrays to zero
piarray=np.zeros(repeats)
narray=np.zeros(repeats)
#Detemermine: Stdev, And dx
var=((10-1+1)**2-1)/12
stdev=np.sqrt(var)
stdevt=stdev/np.sqrt(samples)
dx=1/samples
for p in range(repeats):
#Create Array random numbers
random=np.random.choice([0,1,2,3,4,5,6,7,8,9],[trials,samples])
#Determine mean from random no of numbers (of samples)
m=np.mean(random,axis=1)
mn=np.mean(m)
#Create dataframe and count number of observation per interval
df=pd.DataFrame({'m' : m})
dfg=df.groupby(['m'])['m'].agg(['count']).reset_index()
#Histogram x=bins and y is density
x=dfg['m'].to_numpy()
y=dfg['count'].to_numpy()
y=y/(dx*trials)
#Count number of observation on mean: 4.5
out=dfg[(dfg['m'] < 4.5 +dx/2) & (dfg['m'] > 4.5-dx/2)]
nc=out['count'].to_numpy()
n=np.sum(nc)
narray[p]=n
#Calculate pi and fill array
pi=0.5*(trials*dx/(stdevt*n))**2
piarray[p]=pi
nmean=np.mean(narray)
nstdev=np.std(narray)
nstdevm=nstdev/np.sqrt(repeats)
pim=0.5*(dx*trials/(stdevt*nmean))**2
piminc=0.5*(dx*trials/(stdevt*(nmean+2*nstdevm)))**2
pimaxc=0.5*(dx*trials/(stdevt*(nmean-2*nstdevm)))**2
print('pi: ' + str(np.round(pim,4)))
print(str(np.round(piminc,4)) + '<pi<' + str(np.round(pimaxc,4)) + ' (95%)')
```

With the attached simulation $\pi \approx 3.141..$, that requires a total of: $800*150000*10000=1.200.000.000.000$ equivalent dice trows.

I later noticed that $\pi$ can also be calculated with the density at the position of $\sigma$ (or any other position). Though then one requires Euler's number $e$. So basically after determining $\pi$ on can determine Euler's number.

$$\boxed{\pi \approx \frac{1}{2e} \cdot \left( \frac{\Delta x N}{ n_{\sigma} \sigma} \right)^{2}}$$