Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #50382
| References | <CAPTjJmq_7+rtNV22cxpLXQ+G1XfCyJvKckN+2B3PjfVEEs-5Qw@mail.gmail.com> <CALwzidmy-CZYOZ2hdcssOWOZ+U8GVv8MrcjG0LD6TtwbdhBX6w@mail.gmail.com> <CALwzidmkf6WOGkMWPJ8we+pA6RTkvJK+0ZRi0DJ0DUt245rruQ@mail.gmail.com> |
|---|---|
| Date | 2013-07-11 03:14 +1000 |
| Subject | Re: Prime number generator |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.4540.1373476473.3114.python-list@python.org> (permalink) |
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
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Prime number generator Chris Angelico <rosuav@gmail.com> - 2013-07-11 03:14 +1000
csiph-web