Message361086
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 ... |
|
Date |
User |
Action |
Args |
2020-01-31 00:51:59 | tim.peters | set | recipients:
+ tim.peters, lemburg, rhettinger, mark.dickinson, vstinner, stutzbach, steven.daprano, serhiy.storchaka, veky, Ananthakrishnan |
2020-01-31 00:51:59 | tim.peters | set | messageid: <1580431919.89.0.565439675962.issue39479@roundup.psfhosted.org> |
2020-01-31 00:51:59 | tim.peters | link | issue39479 messages |
2020-01-31 00:51:59 | tim.peters | create | |
|