Skip to content

Add miller rabin primality #6293

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

DomTr
Copy link

@DomTr DomTr commented Jun 15, 2025

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized it.
  • All filenames are in PascalCase.
  • All functions and variable names follow Java naming conventions.
  • All new algorithms have a URL in their comments that points to Wikipedia or other similar explanations.
  • All new code is formatted with clang-format -i --style=file path/to/your/file.java

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 84.84848% with 5 lines in your changes missing coverage. Please review.

Project coverage is 74.11%. Comparing base (a21abe6) to head (329e442).

Files with missing lines Patch % Lines
...thealgorithms/randomized/MillerRabinPrimality.java 84.84% 2 Missing and 3 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #6293      +/-   ##
============================================
+ Coverage     74.10%   74.11%   +0.01%     
- Complexity     5345     5360      +15     
============================================
  Files           677      678       +1     
  Lines         18639    18672      +33     
  Branches       3618     3626       +8     
============================================
+ Hits          13812    13839      +27     
- Misses         4272     4275       +3     
- Partials        555      558       +3     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@vil02
Copy link
Member

vil02 commented Jun 15, 2025

Is it a duplicate of MillerRabinPrimalityCheck.java?

@DomTr
Copy link
Author

DomTr commented Jun 15, 2025

Is it a duplicate of MillerRabinPrimalityCheck.java?

Yes, it looks like so. I didn't check it before writing the code, sorry. I thought that Miller-Rabin primality test will certainly be in the randomised algorithm section, so I didn't check others.
The main difference is that my version also works with integers which are very big, e.g. 30-digit long. Tests with 30-digit numbers are in the added MillerRabinPrimalityTest.java

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.

3 participants