In article <[EMAIL PROTECTED]>,
Steve Bergman wrote:
>BTW, can this code be made any more efficient?

>def primes():
>    primes=[3]
>    for x in xrange(5,10000000,2):
>        maxfact = int(math.sqrt(x))
>        flag=True
>        for y in primes:
>            if y > maxfact:
>                break
[...]

You can omit the call to math.sqrt if you test this instead.

    y*y > x

in place of if y > maxfact: .

Pka

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

Reply via email to