Prime number generator
rosuav at gmail.com
Wed Jul 10 19:14:30 CEST 2013
On Thu, Jul 11, 2013 at 2:54 AM, Ian Kelly <ian.g.kelly at gmail.com> wrote:
> As promised. Apologies for the excessive commenting. As noted, this
> implementation is a recursive generator, which is done so that the
> primes in the sieve can go only up to the square root of the current
> prime, rather than tossing in every prime seen so far.
Nice. Comes in at 0.23369310904039478 in my oh-so-scientific
benchmarking, so it's comparable to several of Steven's algorithms.
Runs on Python 3.3 with just the tiny tweak of converting iter.next()
More information about the Python-list