Question about generators
David Robinow
drobinow at gmail.com
Sun Jul 12 22:00:15 EDT 2009
On Sun, Jul 12, 2009 at 9:24 PM, Cameron
Pulsford<cameron.pulsford at gmail.com> wrote:
> As far as the primes generator, it does not generate any non-primes. All
> primes (except 2, 3 and 5) are in the form (6*x + 1, 6*x + 5) where is x is
> [1, 2, ..., n]. The only time it doesn't generate a prime is when x + (1 or
> 5) % 5 == 0. Which is what that last part is making sure doesn't happen. I'm
> not a mathematician or anything so correct me if I'm wrong, but that's what
> I've read.
All you're doing is eliminating numbers divisible by 2,3, and 5.
Your generator includes 49 (7 * 7), 77 (7*11), 91 (7*13), 121 (11*11), etc.
More information about the Python-list
mailing list