Tim Peters <t...@python.org> added the comment:

Raymond, there was a thread a while back about adding an `imath` module, to 
package the number-theoretic functions that frequently come up.  _All_ these 
things should really go into that instead, IMO.  `math` started as a thin 
wrapper around C's libm, and has been losing its once-exclusive focus on 
functions for working with Python floats.  I think that focus was valuable.

In that older thread, I suggested a `probable_prime(n)` predicate function, and 
posted my pure-Python Miller-Rabin implementation.  Simple (as such things go), 
but I wouldn't aim to compete with (say) gmp.

I don't think `is_prime(n)` is suitable for Python.  Proving that a large 
integer absolutely is prime is either quite slow or quite complicated.  In 
practice, even professionals in critical applications are happy to settle for 
probabilistic assurances, because an arbitrarily tiny probability of error can 
be obtained very much faster than a deterministic proof.

Anyway ;-) , ya, I like the idea, but I'd sure like it to go into a module 
where it obviously belongs.  Also a function, e.g., to generate primes, and ...

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue39479>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to