Comment #1 on issue 2003 by asmeurer: Use factorint() with limit argument
in sympy/core/numbers.py
http://code.google.com/p/sympy/issues/detail?id=2003
Another thing is that we still need to catch perfect powers, even if they
are of large primes, because that is also inexpensive (see also what Maple
does in the above mentioned thread). factorint() has the capability to do
this, and according to the docstring, will sometimes even do it with the
limit option, but it doesn't always:
In [69]: d = nextprime(2**100)
In [70]: factorint(d**2, limit=100)
Out[70]: {1606938044258990275541962093043441035048642082211966411156409: 1}
In [71]: d
Out[71]: 1267650600228229401496703205653
In [72]: d**2
Out[72]: 1606938044258990275541962093043441035048642082211966411156409
In [73]: factorint(d**2, verbose=True)
Factoring 1606938044258990275541962093043441035048642082211966411156409
Trial division with primes between 3 and 250
Checking if remaining factor terminates the factorization
-- Remaining factor is a perfect power: 1267650600228229401496703205653 ** 2
Out[73]: {1267650600228229401496703205653: 2}
So we need to isolate that part of the algorithm and add a perfect_power
option to factorint() that forces it to do it always with the limit
argument, so we can use that in the Integer.eval_power() code.
--
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.