Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #51619
| Newsgroups | comp.lang.python |
|---|---|
| Date | 2013-07-30 21:57 -0700 |
| References | <mailman.4522.1373464867.3114.python-list@python.org> <15167633-b6e7-46cc-a043-8dfe8aaad11e@googlegroups.com> <mailman.4525.1373469147.3114.python-list@python.org> |
| Message-ID | <d170028c-d6fa-455a-a6b8-aeb2938de85d@googlegroups.com> (permalink) |
| Subject | Re: Prime number generator |
| From | bryanjugglercryptographer@yahoo.com |
Chris Angelico wrote: > Bas wrote: > > Still trying to figure out your algorithm ... > > It's pretty simple. (That's a bad start, I know!) Like the Sieve of > Eratosthenes, it locates prime numbers, then deems every multiple of > them to be composite. Unlike the classic sieve, it does the "deem" > part in parallel. Instead of marking all the multiples of 2 first, > then picking three and marking all the multiples of 3, then 5, etc, > this function records the fact that it's up to (say) 42 in marking > multiples of 2, and then when it comes to check if 43 is prime or not, > it moves to the next multiple of 2. This requires memory to store the > previously-known primes, similarly to other methods, but needs no > multiplication or division. Knuth points to the method, using a priority queue, in exercise 15 of section 5.2.3 of /Sorting and Searching/, and credits it to "B. A. Chartres". -- -Bryan
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Prime number generator Chris Angelico <rosuav@gmail.com> - 2013-07-11 00:00 +1000
Re: Prime number generator Bas <wegwerp@gmail.com> - 2013-07-10 07:35 -0700
Re: Prime number generator Chris Angelico <rosuav@gmail.com> - 2013-07-11 01:12 +1000
Re: Prime number generator bas <blswinkels@gmail.com> - 2013-07-10 08:47 -0700
Re: Prime number generator Chris Angelico <rosuav@gmail.com> - 2013-07-11 02:15 +1000
Re: Prime number generator Joshua Landau <joshua@landau.ws> - 2013-07-10 18:47 +0100
Re: Prime number generator Ian Kelly <ian.g.kelly@gmail.com> - 2013-07-10 12:56 -0600
Re: Prime number generator Joshua Landau <joshua@landau.ws> - 2013-07-10 20:06 +0100
Re: Prime number generator bryanjugglercryptographer@yahoo.com - 2013-07-30 21:57 -0700
Re: Prime number generator Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-07-10 16:01 +0000
Re: Prime number generator Chris Angelico <rosuav@gmail.com> - 2013-07-11 02:52 +1000
Re: Prime number generator albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-07-30 10:58 +0000
Re: Prime number generator Ian Kelly <ian.g.kelly@gmail.com> - 2013-07-30 11:33 -0600
csiph-web