Login
This is a place holder for potential sponsor logos.
Miller-Rabin prime test
The Miller-Rabin prime test is a probabilistic test based on the following
Theorem 1 Let $N\geq 3$ be an odd number and $N-1=2^tn$ , $n$ odd. If and only if for every $a\in\mathbb{Z}$ with $\gcd(a,N)=1$ we have
for some $s\in\{0,\dots,t-1\}$ , then $N$ is prime. If $N$ is not prime, then let $A$ be the set of all $a$ satisfying the above conditions. We have $$\text{Card}(A)\leq\frac{1}{4}\varphi(N),$$ where $\varphi$ is Euler's Phi-function.
A composite number $N$ satisfying conditions (for some $s\in\{0,\dots,t-1\}$ , then $N$ is prime. If $N$ is not prime, then let $A$ be the set of all $a$ satisfying the above conditions. We have $$\text{Card}(A)\leq\frac{1}{4}\varphi(N),$$ where $\varphi$ is Euler's Phi-function.
- Choose a random $2\leq a\leq N-1$ .
- If $\gcd(a,N)\neq 1$ , we have a non-trivial divisor of $N$ , so $N$ is not prime.
- If $\gcd(a,N)=1$ , check if the conditions (
) are satisfied. If not, $N$ is not prime, otherwise the probability that $N$ is not prime is less than $\frac{1}{4}$ .
When comparing this test with the related Solovay-Strassen test one sees that this test is superior is several ways:
- There is no need to calculate the Jacobi symbol.
- The amount of false witnesses, i.e. numbers $a$ that report $N$ as a prime when it is not, is at most $\frac{N}{4}$ instead of $\frac{N}{2}$ .
- One can even show that $N$ which passes Miller-Rabin for some $a$ also passes Solovay-Strassen for that $a$ , so Miller-Rabin is always better.
Miller-Rabin prime test is owned by mathwizard.
None.
[ View all 2 ]

