If you write down binary representations of all prime numbers starting from 3 up to some (very big) $N^{th}$ prime number and denote with $S_1(N)$ the total number of ones (1) and with $S_0(N)$ the total number of zeros (0) used in all binary representations, what kind of relation would you expect between $S_1$ and $S_0$?
I did not expect to see anything like 50:50 distribution. All binary representations start with 1 and all primes end with 1. So it looks like digit 1 is favored: binary representation of every odd prime is guranteed to have at least two ones. There's no such guarantee for zeros.
But what is the ratio between ones and zeros if you remove the first and the last digit from all binary representations? I meen, what happens if you look only at the "central" part of the number?
I might be too naive but I expected to see that, with the first and the last digit removed from every binary presentation, the ratio between ones and zeros would be close to 50:50. In other words, I expected to see something like:
$$S_1(N)\approx S_0(N) + 2 N\tag{1}$$
But in reality it's not like that and I would say not even close. I did an experiment with the first 10 million primes and got the following results (BTW, 10,000,000th odd prime turned out to be 179,424,691):
$$N=10,000,000$$ $$S_1=139,605,415$$ $$S_0=124,501,052$$
Proper relationship seems to be:
$$S_1(N) \approx S_0(N) + \frac32 N\tag{2}$$
The margin of error in my experiment is less then 0.1%.
Is there a simple explanation why the correct factor seems to be equal to $\frac32$, not 2?
(I can also share the Java code if someone wants to validate it.)
EDIT: Here is the graph of function:
$$\frac{S_1(N)-S_0(N)}{N}$$
for the first 20 million primes:
It turns out that the value 1.5 is reached only from time to time.
