amritansh22 / Data-Structures-and-Algorithms-in-cpp

This repository is in development phase and will soon provide you with c++ code of various data structures and algorithms
MIT License
365 stars 341 forks source link

Create Miller-Rabin_primalityTest.cpp #620

Open Swish78 opened 1 year ago

Swish78 commented 1 year ago

This code checks if a given number is likely to be a prime using the Miller-Rabin primality test, which is a probabilistic algorithm. The algorithm chooses a random number and tests whether it is a witness for the compositeness of the given number. This is repeated a number of times to increase the confidence in the result. If the number passes all tests, it is considered likely to be prime.

welcome[bot] commented 1 year ago

Thanks for opening this pull request! Please be sure that you have checked out our contributing guidelines.