Comment #8 on issue 2003 by smichr: Use factorint() with limit argument in
sympy/core/numbers.py
http://code.google.com/p/sympy/issues/detail?id=2003
factorint doesn't use trial division first and then other methods, it does
a little of both:
limit given
lo=3
high=250
while 1:
trial divide with primes lo to high
if high > limit: quit
try other methods
lo, high = high, 2*high
That's why it says that limit won't guarantee that no larger factors are
found.
So you are going to get the more expensive methods until you have finally
exceeded your limit.
There is nothing so dumb (and quick) for small trial division testing as
factor_trial_division in factor_.py. Everything there uses primes (which
are being generated slower than necessary [*]) and multiplicity and
trailing to work smarter...but I don't know if it's the Memoizer decoration
or what, but good old factor_trial_division is always orders of magnitude
faster in my tests.
[*]
http://groups.google.com/group/sympy/browse_thread/thread/5e452a5b9d091f0f/8a0b73509d4d725a?lnk=gst&q=prime#8a0b73509d4d725a
--
You received this message because you are subscribed to the Google Groups
"sympy-issues" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sympy-issues?hl=en.