mersenneforum.org (https://www.mersenneforum.org/index.php)
-   Math (https://www.mersenneforum.org/forumdisplay.php?f=8)
-   -   Sum of all integer digits of all primes between 1 an n (https://www.mersenneforum.org/showthread.php?t=6359)

 AntonVrba 2006-09-20 12:26

Sum of all integer digits of all primes between 1 an n

With the discovery of M44 (congratulations GIMPS) I pondered over the thought if it is possible to count/calculate all the ones of all the primes between 2 and M44. It is a bit off-topic but the result is interesting.

To calculate or estimate the number of ones, I set about as follows.

Define $$c_b(n)$$ as the sum of all base-b integer digits between 1 and n and can be expressed as.
$$c_b(n)=\sum_{k = 0}^{m}\,\,{d_k}\,\left( b^k\, \frac{{d_k} + k\, \left( b - 1\right) - 1}{2} + {mod (n,\,{b^k})} + 1\right)$$

Above has the spot values $$c_b\left( b^m-1 \right) =\frac{m\left( b-1\right)b^m}{2}$$

Now assume $$m$$ to be large then $$m=log_b(b^m-1)=ln(b^m-1)/ln(b)$$ and proportioning $$c_b(b^m-1)$$ to the number of primes between $$1$$ and $$b^m-1$$ which is approximated in the Prime Number Theorem as $$(b^m-1)/ln(b^m-1)$$ we obtain the unexpected result that the cumulative sum of all base-b integer digits of all the primes between $$1$$ and prime $$b^m-1$$ approximates to

$$\frac{(b-1)(b^m-1)}{2\, ln(b)}\,$$

[b]Conjecture [/b]
The ratio$$\kappa_b$$ defined as "the sum of all base-b digits of all the primes between 1 and n" to "n", converges to the constant $$\frac{b-1}{2\, ln(b)$$ for increasing n.

$$\kappa_2=0.7213476$$ and $$\kappa_{10}=1.9543251$$

A computation check confirms above tendency already at relatively small values of n.

Is above already known or have I introduced a new constant?

In parctice how will the constant depart from above definition?

Regards
Anton Vrba

 AntonVrba 2006-09-20 12:34

For the Mathematica users
[code]
CumSumDigits[n_, b_] := Module[
{ss, p, d0, d1, m} ,
ss = p = d0 = 0 ;
m = n ;
While[m > 0, {
If[(d1 = Mod[m, b]) != 0, {
ss += d1( b^p(b - 1) p + b^p (d1 - 1) + 2(d0 + 1))/2,
d0 += b^p d1}],
p += 1,
m = IntegerPart[m/b],
}] ;
Return [ss ] ;
][/code]
and can be checked by evaluating
[code]CumSumDigits[(10^123 - 1)/9, 10] - CumSumDigits[(10^123 - 1)/9 - 1, 10][/code]

 AntonVrba 2006-09-20 17:20

here is a base-10 evaluation of $$\kappa_{10}$$ counting up to
[code]Prime Actual Calculated Actual/Calculated
99999989 2.09217 2.07412 1.0087
999999937 2.07641 2.05933 1.0083
9999999967 2.06389 2.00702 1.0078
99999999977 2.05366 2.03844 1.00747
[/code]
Actual cumulative digit count of all primes 2 to p divided by the last prime p (C program)

Calculated value $$\frac{\pi(p)\, c_{10}(p)}{p^2}$$

$$\pi(p)$$ being the prime counting function

An on the same basis a base-2 evaluation for $$\kappa_2$$

[code]
32749 0.845614 0.804225 1.05146
65521 0.837533 0.798769 1.04853
131071 0.832198 0.794553 1.04738
262139 0.825139 0.789684 1.0449
524287 0.820511 0.78624 1.04359
1048573 0.815104 0.782262 1.04198
2097143 0.810823 0.779118 1.04069
4194301 0.806539 0.776155 1.03915
8388593 0.802665 0.773417 1.03782
16777213 0.798989 0.770954 1.03636
33554393 0.795861 0.768785 1.03522
67108859 0.792815 0.766688 1.03408
134217689 0.790022 0.764787 1.033
268435399 0.787444 0.763058 1.03196
536870909 0.785043 0.76144 1.031
1073741789 0.782845 0.75996 1.03011
2147483647 0.780761 0.758568 1.02926
[/code]

 All times are UTC. The time now is 06:39.