[Tutor] pickle problems

Richard D. Moores rdmoores at gmail.com
Wed Aug 22 18:17:19 CEST 2012


I've incorporated many of the suggestions I've received here.

Here's a function, factor_integer(), for quickly factoring any integer
up to 1e17: <http://pastebin.com/BLfV0EMw>.

Larger integers will be factored eventually -- the wait can be long or
short. Probably long if they require the services of lines 82-91.

Examples of extremes, both between 1e25 and 1e26:
2,835,334,663,465,375,591,838,337  [3, 19, 37, 71, 947,
19994908447741489]  1.172 secs
9,349,337,574,247,205,482,125,105  [3, 5, 2027, 2311296661,
133039358281] 402.5 secs

These were found with the use of a related script,
"factor_random_integers.py", pasted at <http://pastebin.com/itqvuMXj>


Dick Moores


More information about the Tutor mailing list