Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #50382 > unrolled thread

Re: Prime number generator

Started byChris Angelico <rosuav@gmail.com>
First post2013-07-11 03:14 +1000
Last post2013-07-11 03:14 +1000
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Prime number generator Chris Angelico <rosuav@gmail.com> - 2013-07-11 03:14 +1000

#50382 — Re: Prime number generator

FromChris Angelico <rosuav@gmail.com>
Date2013-07-11 03:14 +1000
SubjectRe: Prime number generator
Message-ID<mailman.4540.1373476473.3114.python-list@python.org>
On Thu, Jul 11, 2013 at 2:54 AM, Ian Kelly <ian.g.kelly@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()
to next(iter).

ChrisA

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web