Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Question about sum of primes and sample size

  1. Feb 18, 2012 #1
    My question is this, is there a known convergence of the sum of primes divided by the square of the sample size?

    I've just been looking at it, admittedly with only the first 50,000 primes, and it looks as if it is converging on a number near 6. If you plot the points below, you might see what I mean:

    5000 ... 4.57821036
    10000 ... 4.96165411
    15000 ... 5.18540836
    20000 ... 5.344388313
    25000 ... 5.466979301
    30000 ... 5.567297328
    35000 ... 5.651915416
    40000 ... 5.725362149
    45000 ... 5.789698869
    50000 ... 5.84735752

    Is this a known phenomenon, and if so, what is it called?

    If not, and someone has access to a greater number of primes, it would be interesting to see if the trend continues. Is there a ceiling at 6 (I doubt it, it would be a little too neat), or at 2pi (which would be rather cool), or does it just keep increasing (but at an ever decreasing rate, thus being a prime example of Xeno's Arrow!)

    I am happy to do the finger work, if someone can direct me to, or send me the primes above 50,000 in a useable format (actually I mean by that the primes above the 50,000th prime, so primes above 611,953).


    Last edited: Feb 18, 2012
  2. jcsd
  3. Feb 18, 2012 #2
    By making some simple heuristic arguments based on the prime number theorem, you may discover that your ratio diverges, asymptotically to (ln N)/2, where N is the number of primes in your sample.
  4. Feb 18, 2012 #3
    Hm, interesting theory. I tried it though, and the series is diverging away from ln(N)/2.

    The last time the gap closes is at n=263 and the narrowest gap is at n=30. Up until then it looked vaguely promising.

    Any other theories?


  5. Feb 18, 2012 #4
  6. Feb 18, 2012 #5
    Thanks, it is indeed useful. I'll see what the numbers do - it might take some time with all those primes though.


  7. Feb 18, 2012 #6
    Just think of an infinite number of primes.. That group would be small.
  8. Feb 19, 2012 #7
    Ok, done it to n=250,000. It went straight past 6, straight past 2pi and is now at 6.724115 with the delta being about 2.173x10^-6 for each increment of n (with some error introduced by excel, I assume).

    That delta has been consistently decreasing, although the rate of decrease is slowing, asymptotically from the look of it.

    Time to ask the question again, is this a known phenomenon, and if so what is it called?



    PS I was looking at divergent and convergent series. (1/n)! is divergent, (1/n^2)! is convergent, so given that for every value of n, the prime (prime_sub_n) is higher than n, it follows that ((prime_sub_n)/n^2)! is divergent. Happy with that, but it's not what I am looking at, I am looking at:


    which could, conceivably, be convergent.
  9. Feb 19, 2012 #8
    OK, just to let you know again, that the "phenomenon" is called the Prime Number Theorem, and that a derived known result is the following:

    Let S(n) be the sum of the first n primes, then the ratio between S(n) and n2(ln n)/2 approaches 1 as n goes to infinity.

    From what point did your numbers differ more than say 10% from (ln n)/2? Or perhaps you read my previous post as ln (n/2)? Then I am sorry for the ambiguity.

    You ask about the convergence of some series. You seem to be using the factorial notation (!), instead of summation (Ʃ), which is somewhat confusing, and in that case the answer is again (ln n)/2.
  10. Feb 19, 2012 #9
    Ah, yeah, you're right re the factorial notation, I don't quite know why I did that. Perhaps a bit frazzled by all the number crunching.

    But with regard to (ln n)/2, it simply doesn't work.

    Using your notation,

    S(n=250,000) = 4.20257x10^11

    n^2 = 6.25x10^10

    S(n)/n^2 = 6.7244115

    (ln n)/2 = 12.42921619

    This is a variation closer to 100% than 10%.

    Note that the Prime Number Theorem is about the number of primes under a certain number. So, noting that the 250,000th prime is 3497861, then the relevant equation is:

    Number of primes under 3497862 = 250000 =~ 3497862 / ln (3497862) = 232143.639

    which is about right, with a margin of error acceptable for the approximation and fact that quarter of a million is a fair way off infinity :)

    Thanks for the effort, but I'd really like to know more about the specific phenomenon that I've highlighted.

    I'm going to try a little latex to write precisely what I mean:

    where Prime[itex]_{n}[/itex] is the n[itex]^{th}[/itex] Prime, ( [itex]\sum [/itex][itex]^{n}_{i=1}[/itex] Prime[itex]_{i}[/itex] ) / n[itex]^{2}[/itex] → what? as n → ∞

    After 250,000 primes the value remains under 7, so it doesn't look like it tends to infinity, but ... it could just be on the very slow road to it.


  11. Feb 19, 2012 #10
    At half a million, the figure has broken through 7 (actually did that before 450,000), but the tapering off continues.
  12. Feb 19, 2012 #11
    In your example above where you note that the error is close to 100% you have made an error. ln(250,000)/2=6.21.... You forgot to divide by 2. This is a known result and the divergence is very, very, very slow. For example ln(10^9)/2=10.36, ln(10^12)/2=13.82, and ln(10^15)/2=17.27.
  13. Feb 19, 2012 #12
    True alan2, fingers let me down again. I just plugged it into the calculator and sure enough, you are right for 250,000. Earlier, I had a range of (ln n)/2 in a spreadsheet, next to the figures I was generating, and noted that the numbers actually diverge, as you point out, so I dismissed the whole hypothesis. I think I was too quick to dismiss it - so my apologies to Norwegian. I did so because, I had noted at first that the numbers start off being quite bit below (ln n)/2 and never looked like approaching it. However, when I plot them against each other at greater values of n, they seem to be a nice straight line, albeit with an offset.

    So, thanks all, I think I am happy with it being related in some way to (ln n)/2. For completeness, the offset seems to be about 0.5, but I'm not going to worry overly why that is the case!


  14. Feb 19, 2012 #13
    The 0.5 offset you mention, is of the same nature and magnitude, and directly related to the error of the n/ln(n) approximation of p(n).

    PNT says that p(n) ≈ n/ln(n) (sorry bad notation ≈ for asymptotic)

    This is the simplest asymptotic formula for p(n), but not the most accurate. n/[(ln n)-1] gives a much better approximation for small n, but have of course the same asymptotic behaviour. Similarly, [(ln n)-1]/2 may be a better approximation for your s(n)/n2, although I dont know if -1 is optimal in this case. (it is in the modified PNT btw.)
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Similar Discussions: Question about sum of primes and sample size
  1. Question about primes (Replies: 11)