# Prime Distribution Linked To Shannon Entropy

I've recently produced a result that links the distribution of primes to Shannon Entropy. The result uses The Prime Number Theorem. I would like to know if my result is valid and if so how can it be interpreted or extended?

The result is here: http://www.math-math.com/2015/05/a-prime-number-surprise.html

I think that is not correct (maybe I'm mistaken, but in any case is great to see other options).

You want to calculate the Shannon entropy of finding a prime. You suppose that the probability of finding a number in a sequence of lenght is $1/n$, so the information you have of the system is $\log(n)$, so the information per number is $\log(n)/n$. Until that point I agree with you.

But now you say that if you have $m$ primes in the sequence then every number gives $m \log(n) / n$ per prime, and say that the total information about them is 1 because of the prime number theorem...

Not sure about that. Let's say you have $m$ primes in your sequence. Then, if I pick randomly a number, the probability to obtain a prime is $m/n\simeq 1/\log(n)$, so the information associated with this is $S=\log_2(\log(n)) / \log(n)$. Note that if $n \rightarrow +\infty$ this tends to 0. This is because the probability to get a prime number in the limit tends to 0 (if it's nearly impossible to get a prime number, then you have a lot of certainty that the number will not be prime and the information you get is very small). This makes a lot more sense than a constant value, given that as you make $n$ larger is more and more difficult to find primes.

Your reasoning is good, but I think that you should not sum the entropies of every prime number, because you're triying to determine the entropy associated with "finding a prime number", and what you do is summing every entropy.

Ah, and another funny thing. In information theory usually $\log(x)$ stands for $\log_2(x)$ because the information is measured in bits. That implies that, even if your reasoning is correct, the Shannon entropy (in bits) is $\log(n)/\log_2(n) = \log(2) \simeq 0.69$ bits. The result you gave is in nats.

Gregory Chaitin suggested some years ago that there is a link between the primes and disorder or entropy in Chaitin, G.J.; Schwartz, J.T. A note on Monte Carlo primality tests and algorithmic information theory. Pap. Algorithmic Inf. Theory 1990, 8, 197.

Seven years ago I used simple function called BiEntropy which I had designed to investigate the order and disorder of the e.g. prime constant - the 1's and 0's corresponding to the primality of the natural numbers. ie we encode 0,1,2,3,4,5,6,7,8,9.... as 0011010100.... The BiEntropy function returns a real number between 0.0 and 1.0 reflecting the order and disorder of the binary series (of arbitrary length) using a weighted average of the Shannon entropies of the string and its first n-2 binary derivatives. This series shows that the prime constant (in binary) is disordered. In fact it is irrational as proven by Hardy & Wright in the 1930's. That work is documented here: https://arxiv.org/abs/1305.0954

A couple of years ago, I finally got round to investigating the BiEntropy of the primes themselves. It turns out that there is empirically a very close relationship between BiEntropy and Primality - the higher the BiEntropy, the more likely a number is prime. The result is repeated in Trinary. Plus there is a related simple theory of periodic numbers that shows how these empirical results generalise to all the Natural numbers. The paper is available here: https://www.mdpi.com/1099-4300/22/3/311

To answer your question directly, there is a very close relationship between entropy, specifically Shannon's Entropy, and the distribution of primes.