-
-
Notifications
You must be signed in to change notification settings - Fork 491
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failure to handle large prime input with Pari's factor()
#35219
Comments
factor()
factor()
Running the same factoring using The only fix for SageMath is to either update to Output example for 2.13.3
|
Just to keep this updated with Pari, 2.15.3 is the latest stable release and the bug still remains. |
|
Cherry-picking the commit mentioned above on top of 2.15.3 merges cleanly, and it seems to fix the issue — but we should probably try to find a more minimal patch? |
it's ok to use the upstream patch as is |
Reported upstream https://pari.math.u-bordeaux.fr/cgi-bin/bugreport.cgi?bug=2469 Waiting for a proper fix before proceeding with #35302 |
Upstream patch is now available. |
### 📚 Description update pari to 2.15.4, drop patch Will fix sagemath#35219 ### 📝 Checklist - [x] I have made sure that the title is self-explanatory and the description concisely explains the PR. URL: sagemath#35302 Reported by: Dima Pasechnik Reviewer(s): Dima Pasechnik, Lorenz Panny, Michael Orlitzky
### 📚 Description update pari to 2.15.4, drop patch Will fix sagemath#35219 ### 📝 Checklist - [x] I have made sure that the title is self-explanatory and the description concisely explains the PR. URL: sagemath#35302 Reported by: Dima Pasechnik Reviewer(s): Dima Pasechnik, Lorenz Panny, Michael Orlitzky
### 📚 Description update pari to 2.15.4, drop patch Will fix sagemath#35219 ### 📝 Checklist - [x] I have made sure that the title is self-explanatory and the description concisely explains the PR. URL: sagemath#35302 Reported by: Dima Pasechnik Reviewer(s): Dima Pasechnik, Lorenz Panny, Michael Orlitzky
Is there an existing issue for this?
Did you read the documentation and troubleshoot guide?
Environment
Steps To Reproduce
When working with large primes, Pari no longer seems to properly handle
factor(large_prime)
and hangs indefinitely. This affects other functionality such asMod(2, p).sqrt()
orZmod(p)(2).sqrt()
, as they rely onfactor()
under the hood. Note that it does not affectGF(p)(2).sqrt()
, as Sage already knows the modulus is prime in this case.For example, defining a large prime and attempting to factor it hangs:
If we set the verbosity to be high we get the following (truncated) output
Note, if we supply an integer which is composite with a very large prime factor, Pari seems to work as expected, so the issue may be that there is no primality check at the beginning of the Pari function
factor()
:Expected Behavior
For prime input to be tested for primality before applying various factoring algorithms
Actual Behavior
Pari seems to attempt to factor the large integer without checking first that the input is prime and hangs indefinitely as no factors of the prime will be found
Additional Information
SageMath 9.8 included the ticket #34537, which upgraded PARI to version 2.15.2. Potentially, the factoring error was introduced in this new version.
The text was updated successfully, but these errors were encountered: