Shawn Milochik <[EMAIL PROTECTED]> wrote:
>  Any improvements anyone?

  >>> import gmpy
  >>> for x in range(3,1000,2):
  ...     if gmpy.is_prime(x):
  ...             print x,"is prime"
  ...
  3 is prime
  5 is prime
  7 is prime
  [...]
  >>> gmpy.is_prime(2**607-1)
  1
  >>> gmpy.is_prime(2**608-1)
  0

Cheating perhaps!  Note is_prime will be a probabalistic test for
large numbers...

-- 
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to