[SciPy-user] prime numbers

Alan G Isaac aisaac at american.edu
Thu Oct 23 10:37:43 EDT 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