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
Error when factoring. #1
Comments
Thanks for the report, I see it too. I'm looking into how to fix it but here are a few initial thoughts:
|
This is a work-around for issue #1 on the Github project page, that the algorithm has an error rather than factoring the number 327146098439579. While I gain the knowledge necessary to fix bug in HMPQS, I am switching the factoring method to a simpler method. After checking what effect this will have, I've found that it is significantly slower on average than the HMPQS method, even in number ranges where it should win. That isn't too surprising as almost zero effort has been put into optimizing it.
I just realized you could use the default algorithm and switch to the other one when an error is thrown. It isn't pretty, but it is more efficient than just using the slower algorithm. |
I haven't found time to look for a fix yet, in the mean time I changed the I'll keep this bug report open until I actually fix it.
|
When executing (factor 327146098439579), I get the following error:
Index 2 out of bounds for (SIMPLE-ARRAY FIXNUM (2 46)), should be nonnegative and <2.
[Condition of type SB-INT:INVALID-ARRAY-INDEX-ERROR]
With the following backtrace:
0: (ULIMY-HMPQS::B-GENERATOR 2717 (5 4 3) 3)
1: (ULIMY-HMPQS::MAKE-CUBLETS (4 3) 1.3063123 5 45 3)
2: (ULIMY-HMPQS::MAKE-CUBLETS (3) 2.4202557 4 45 2)
3: (ULIMY-HMPQS::MAKE-CUBLETS NIL 3.4616485 3 45 1)
4: (ULIMY-HMPQS::A-GENERATOR)
5: (ULIMY-HMPQS::QS 327146098439579 :M 0 :B 0 :DELTA-T 0 :OMIT-BELOW 25 :SLP-LOG2 16 :ALFA 32 :REPORT2 NIL :RETURN2 ULIMY-HMPQS::FACTORS)
6: (ULIMY-HMPQS:HMPQS 327146098439579 :REPORT2 NIL)
7: (FACTOR 327146098439579)
I am running sbcl 1.2.5.
The text was updated successfully, but these errors were encountered: