# Some interesting results from PI decimals

I was reading some notes about PI and as a typical IT guy I have decided to test some algorithm but before I wanted to check number quantity per decimal length (explanation in next paragraph). For resource I have used: http://www.piday.org/million.php there I took 1000000 decimal and wrote a small application to see how many times 1,2,3,4,5,6,7,8,9 and 0 numbers are used. And I get some interesting results and wanted to share with you.

i.e. in first 100000 decimal total 9999 0(zero) exist. Generally total number * 100000 very close to decimal length/10;

or

total of 1000000 decimal: 4499934

total of 100000 decimal: 449333

total of 10000 decimal: 44894

total of 1000 decimal: 4476

total of 100 decimal: 477

total of 10 decimal: 41

Do you think it can be interesting? If someone wants I can share full results. (Can be useless information but I was doing just for fun, so dont judge me:))

-
mathworld.wolfram.com/PiDigits.html has some tables of all the digits to higher powers and also explicitly states that the distribution appears uniform (or at least doesn't diverge significantly from a uniform distribution). –  davin Nov 11 '11 at 13:11

(I'd post this as a comment, but ran out of space.)

Your results are not surprising. Partly because there is no (known) reason why any one digit should occur more than other digits, many mathematicians believe that all digits $0$ to $9$ occur with about equal frequency. In technical terms, it is believed that $\pi$ is a normal number.

So among the first $N$ digits, you should expect to see the digit $0$ about $N/10$ times, the digit $1$ about $N/10$ times, and so on: each of the ten digits about $N/10$ times. This approximation gets (relatively) better as $N$ becomes large. So the sum of the first $N$ digits will roughly be \begin{align} &\frac{N}{10}(0) + \frac{N}{10}(1) + \frac{N}{10}(2) + \dots + \frac{N}{10}(9) \\ =& \frac{N}{10} \left( 0 + 1 + \dots + 9 \right) \\ =& \frac{N}{10} (45) \end{align} which is what you're seeing.

-
Good explanation, thank you! :) –  burak Nov 11 '11 at 13:19

The subject has been much studied. For any base $b$, there is a stronger notion called "$b$-normal number" and an even stronger notion called "normal number." For some details, please see this Wikipedia article. Roughly speaking, a number is $10$-normal if for any integer $k$, every sequence of $k$ digits occurs in the long run with equal frequency. So you would have equality not only for single digits. Each pair of adjacent digits would occur with long run frequency $1/100$, and so on.

In the measure-theoretic sense, "almost every" real number is $b$-normal to every base $b$. However, although normal numbers are ubiquitous, it is exceedingly difficult to produce explicit examples, and even more difficult to verify that an explicitly specified number is normal.

It has been long conjectured that $\pi$ is $b$-normal to every base, and in particular is $10$-normal. However, there is so far no proof, and there are no known techniques that might lead to a proof. Computations far beyond those that you have undertaken are consistent with the conjecture that $\pi$ is $10$-normal. The conjecture has been one of the motivations behind calculations of $\pi$ to enormous numbers of digits.

-
Thank Andrea!, I will read related articles first and re-design application. If I understand correct, cant I use modulus to introduce a new sequence to see new results? –  burak Nov 11 '11 at 13:27
There are a number of ways one could use modulus calculations. For example, on could look at the sequence $3$, $31$, $314$, $3141$, and so on modulo some number $m$. If $m=10$ you just get the digits, but if you use $m=3$, or $m=7$, you may get something interesting. I think $10$-normality implies that the sequence you would get has long run frequency $1/m$ for each of $0, 1,\dots, m-1$, but have not written out the details. –  André Nicolas Nov 11 '11 at 14:11
ok it is clear now as PI based on mod10 so there is no logic to test with different condition. If we would use mod6 => 0,1,2,3,4,5,10,11,12,13,14,15,20,... etc then decimal area will extend also, so first I will need to confirm if PI stays same or calculate a new PI number with million decimal:) –  burak Nov 11 '11 at 23:50

If time isn't your primary concern, these kinds of things are usually one-liners in Mathematica:

expmax = ?; Table[DigitCount[N[[Pi], 10^exp], 10, num], {num, 0, 9}, {exp, 1, expmax}]

-