[SciPy-user] prime numbers

Alan G Isaac aisaac@american....
Thu Oct 23 09:37:43 CDT 2008

Walter Mudzimbabwe wrote:
> can anybody help me figure out why the following program cannot produce
> primes upto 10.

I think this has nothing to do with SciPy?
Try comp.lang.python instead.

But you can try:

def isdivisible(n, listt):
     return not all(n%d for d in listt)

This will short circuit appropriately.

Alan Isaac

More information about the SciPy-user mailing list