Skip to content
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

Implement the improved Lucas test from Baillie et al '21 #70

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

fjarri
Copy link
Member

@fjarri fjarri commented Jan 25, 2025

Fixes #21

This should probably go in after #62 is fixed.

The plan is to have a "FIPS" is_prime() preset (introduced in #72), and a "BPSW21" preset (this PR). Which one should be the default is not clear.

Things to consider:

  • I don't know how to reach the point in lucas_test() where all the previous checks have passed, but the final one (Euler's criterion) failed. Baillie et al don't seem to know either, and include the Euler's criterion just in case, because we already have the values for it.
  • Should we remove ExtraStrong and AlmostExtraStrong (and maybe even LucasV) options? They are only used to test against known pseudoprimes, nobody will use them in practice. And they complicate the internals of lucas_test().
  • Speaking of which, can the structure there be improved? I tried to flatten it a bit, but it's still kind of messy.

@fjarri fjarri self-assigned this Jan 25, 2025
@fjarri fjarri requested a review from dvdplm February 4, 2025 19:47
Copy link

codecov bot commented Feb 20, 2025

Codecov Report

Attention: Patch coverage is 95.27778% with 17 lines in your changes missing coverage. Please review.

Project coverage is 98.72%. Comparing base (ad4f439) to head (3ab7b87).

Files with missing lines Patch % Lines
src/presets.rs 91.58% 9 Missing ⚠️
src/hazmat/lucas.rs 95.96% 5 Missing ⚠️
src/hazmat/float.rs 97.22% 2 Missing ⚠️
src/hazmat/miller_rabin.rs 98.24% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #70      +/-   ##
==========================================
- Coverage   99.47%   98.72%   -0.75%     
==========================================
  Files          11       12       +1     
  Lines        1512     1730     +218     
==========================================
+ Hits         1504     1708     +204     
- Misses          8       22      +14     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement full improved Baillie-PSW test
1 participant