Wednesday, May 22, 2013

Listing primes

Naive prime testing compared to the Sieve of Eratosthenes.
cProfile says (for N = 100 000):
  naive testing =  7.912 CPU seconds
  sieve method = 0.064 CPU seconds

Sieving is fast !