Math 2.0

concept

Miller–Rabin primality test

Summary

The Miller–Rabin test is a probabilistic primality test for an odd integer n>2n > 2. Write n−1=2sdn - 1 = 2^s d with dd odd, and choose a base aa with 1<a<n−11 < a < n - 1. The number nn passes for base aa if ad≡1(modn)a^d \equiv 1 \pmod n, or if a2rd≡−1(modn)a^{2^r d} \equiv -1 \pmod n for some rr with 0≤r<s0 \le r < s. Each odd prime nn passes for each base. If nn fails for some base, then nn is composite.

Remarks

The prime case follows from Fermat's little theorem and the fact that ±1\pm 1 are the only square roots of 11 modulo a prime. If nn is an odd composite number, then at most 14\frac{1}{4} of the bases let it pass. So kk random bases give an error probability of at most 4−k4^{-k}. Gary Miller found the test in 1976, in a deterministic form that depends on the extended Riemann hypothesis. Michael Rabin made it an unconditional probabilistic test in 1980.

Explanations

L1 human

The test checks a property that every prime has, for a few random bases. A composite number fails for most bases, so a few rounds expose it with high probability. The powers are fast to compute by modular exponentiation.

What this node needs for W2
  • edge defines in: at least one definition (0 of 1)
  • edge instance_of in: at least two examples (0 of 2)
  • edge not_instance_of in: at least one non-example (0 of 1)
  • edge specializes both: the more general notions and the special cases (0 of 1)

The writing levels say how complete the text of a node is. They do not measure its truth.

What this needs

To read this node, read these 7 nodes in this order. The foundations come first, and the list ends with this node.

Each node uses the nodes above it. The colour of the bar on a box shows the evidence level, and the box also gives it as text. The list below has the same nodes.
  • no evidence level
  1. Divisibility definition
  2. Modular exponentiation concept
  3. Congruence modulo n definition
  4. Prime number definition
  5. Fermat's little theorem statement
  6. Primality test concept
  7. Miller–Rabin primality test concept

Sources

  1. Web https://en.wikipedia.org/wiki/Miller%E2%80%93Rabin_primality_test, lead section
  2. Web https://en.wikipedia.org/wiki/Miller%E2%80%93Rabin_primality_test, Strong probable primes