Miller-Rabin primality test

ID: miller-rabin-primality-test

For an odd candidate , write with odd. A base passes when or for some ; a nontrivial common divisor of or failure of these conditions proves compositeness. A prime passes every base, while an odd composite passes at most one quarter of possible bases. Independent rounds give a false probable-prime probability at most . A passing composite is a strong pseudoprime, stronger than a Fermat pseudoprime.

New to topics? Read the docs here!