A different take on finding primes

Anh Hai Trinh anh.hai.trinh at gmail.com
Wed Nov 18 04:55:24 EST 2009


> 1) google list of prime numbers
> 2) see "Prime numbers list" in the results (number 3 in the results)
> 3) click link that leads towww.prime-numbers.org
>
> I found 455042511 prime numbers in approx 15 seconds.

Not bad at all. How about using http://www.sagemath.org/ (written in
Python).

    sage: time primes_first_n(10^7);
    CPU times: user 4.36 s, sys: 2.43 s, total: 6.79 s
    Wall time: 6.88 s

That used 3G of RAM, you could certainly go higher if you have more
memory.

----aht



More information about the Python-list mailing list