Message364750
Ross:
"implement this logic for a limited range of non-negative n, imposing an upper limit (suggestions welcome) to make sure all provided input can be safely processed. We can then build from there to support larger n going forward if the demand is out there."
Urgh, please no! Arbitrary limits are horrible. Whatever maximum limit N you guess, somebody will want to factorise N+1. Consider this evidence of demand :-)
On what basis would you choose that limit? Basing it on the size of n is the wrong answer: factorising 2**10000000 is easy, and will be found by trial division almost instantly, even though it's a large number with over three million digits.
Another question: since factorization can take a long time, should it be a generator that yields the factors as they are found? |
|
Date |
User |
Action |
Args |
2020-03-21 14:25:26 | steven.daprano | set | recipients:
+ steven.daprano, tim.peters, mark.dickinson, serhiy.storchaka, trrhodes |
2020-03-21 14:25:26 | steven.daprano | set | messageid: <1584800726.33.0.107983167368.issue40028@roundup.psfhosted.org> |
2020-03-21 14:25:26 | steven.daprano | link | issue40028 messages |
2020-03-21 14:25:26 | steven.daprano | create | |
|