sum of first 10^n primes A099824

Max A. maxale at gmail.com
Wed Oct 4 10:31:02 CEST 2006


On 10/3/06, cino hilliard <hillcino368 at hotmail.com> wrote:

> Because we can compute the sums of primes in ranges, group efforts with
> several computers
> could be used to attain sums of the first pi(10^15) primes.

It may happen that the Meissel, Lehmer, Lagarias, Miller, Odlyzko
algorithm for computing pi(x)
( see http://www.ams.org/journal-getitem?pii=S0025-5718-96-00674-6 and
http://numbers.computation.free.fr/Constants/Primes/countingPrimes.ps
)
can be adapted to computing the sum of first n primes. That
potentially may speed up things a lot (e.g., pi(10^n) is known for n
up to 22).

> The simple Pari program below will compute the sum of the first 10^11 primes
> in about 21 days. Someone may want to verify this with Pari.

[...]

> %o A099824 (PARI) sumprimes(n) = a=1;sum(x=1,n,a=nextprime(a+1))

PARI/GP can do faster than that. One needs just to run gp with an
appropriate parameter -p, and then define sumprimes simply as
sumprimes(n) = sum(x=1,n,prime(x))

Max






More information about the SeqFan mailing list