Seymore4Head <Seymore4Head@Hotmail.invalid> Wrote in message:
> On Fri, 05 Sep 2014 12:48:56 -0400, Seymore4Head
> <Seymore4Head@Hotmail.invalid> wrote:
> 

> 
> If you start with the list [3,5,7] and step through the list of all
> remaining odd numbers (step 2), and start appending numbers that won't
> divide by numbers already appended in the list, that would seem like a
> pretty efficient way to find all prime numbers.
> 
> 

Yes, that's a well known optimization.  In addition,  you can stop
 once you reach the square root of the target.  No point in
 dividing by the higher numbers in the list,  since if the result
 comes out even, you'd have already exited the loop.


-- 
DaveA

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to