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

Fix primality test for very small numbers #102

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

rostislav
Copy link
Contributor

Add special cases for primes 2, 3, 5 and 7. Proceed to Miller-Rabin and
BPSW primality tests to get the correct primality result for other small
primes that are factors in the prime products, which are used in the
initial phase of primality testing.

Previously small prime numbers up to 14951 were incorrectly reported as
composite. As this primality test has never been used for so small
numbers, there were no issues in its usage.

Add special cases for primes 2, 3, 5 and 7. Proceed to Miller-Rabin and
BPSW primality tests to get the correct primality result for other small
primes that are factors in the prime products, which are used in the
initial phase of primality testing.

Previously small prime numbers up to 14951 were incorrectly reported as
composite. As this primality test has never been used for so small
numbers, there were no issues in its usage.
Copy link
Contributor

@mariano54 mariano54 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. Can we add a test for this?

@rostislav
Copy link
Contributor Author

Sure, I will add a test.

@github-actions
Copy link

'This PR has been flagged as stale due to no activity for over 60
days. It will not be automatically closed, but it has been given
a stale-pr label and should be manually reviewed.'

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

Successfully merging this pull request may close these issues.

2 participants