Our next version works just like the previous sieve but works on a segment of the number line at a time. That might be why it is called a segmented sieve . Now we are sieving multiples of the primes from 1M numbers at a time, adding those primes to the list and then moving on to the next 1M numbers. I hit 140M primes in 60 seconds on my box... but now I run into a new problem. This version of the sieve quickly consumes all the memory in my box and slows to a crawl. To progress we will need to find a more efficient way of storing the primes we have found.