RabinMiller
RabinMiller, commonly referred to as the Miller–Rabin primality test, is a probabilistic algorithm used to determine whether a given integer n > 2 is prime. It improves on the basic Fermat primality test by using a strong probable prime test, which reduces the chance of false positives and makes the method practical for large numbers, such as those used in cryptography.
The test works by expressing n−1 as d · 2^s with d odd. For a chosen base a
There are both probabilistic and deterministic variants. In the probabilistic form, a small number of random
Historically, the method arose from work by Gary L. Miller in 1976 and was independently developed and