Miller-Rabin primality test Created 2026-10-14 Updated 2026-10-20
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.
Past exam of the mathematics course of the University of Cambridge 2006 ii Paper 4 11H Solution 2026-10-14
For odd coprime to , the Fermat pseudoprime test is . The Euler pseudoprime test meant here is the Euler–Jacobi test,where the right side is the Jacobi symbol. Write , with odd. The strong pseudoprime test passes when , or when for some . Terminology often reserves “pseudoprime” for composite numbers; the question uses it for passing the respective test, including primes.
For the final example, is composite and , so . It passes the Fermat primality test. However , whereas the supplementary law for the Jacobi symbol gives since . Thus 341 is Fermat but not Euler–Jacobi pseudoprime to base two. A weaker convention defining an Euler test merely by would not give the claimed distinction, which is why the Jacobi convention matters.
Past exam of the mathematics course of the University of Cambridge 2010 ii Paper 3 11G ii Solution Created 2026-09-24 Updated 2026-10-14
By the definition of Fermat pseudoprime, is composite as well as odd, and . Put . A proper factorization makes a proper divisor of , so is composite. NowSince , . This is the first passing condition of the Miller-Rabin primality test, with . Thus is a base-two strong pseudoprime. If “pseudoprime” were used to include primes, the compositeness conclusion would fail, for instance gives ; the standard composite definition matters.
Past exam of the mathematics course of the University of Cambridge 2010 ii Paper 3 11G Solution 2026-10-14
The Miller-Rabin primality test first handles as prime and or even as composite. For odd , write with odd and choose a base . A nontrivial proves compositeness. Otherwise compute : the round passes if or . If neither holds, square successively, at most times, and pass if a value occurs; otherwise declare composite. An occurrence of before exhibits a nontrivial square root of one and is also a failure. For prime , Fermat's theorem and the fact that a field has only the square roots force a pass. The standard strong-liar bound says that an odd composite passes for at most one quarter of the bases; independent random rounds therefore have error probability at most after rounds. Passing is a probable-prime verdict, not a proof of primality. A Fermat pseudoprime is composite and passes ; a strong pseudoprime is composite and passes the stronger round above.
Past exam of the mathematics course of the University of Cambridge 2017 ii Paper 3 1G Solution Created 2026-09-24 Updated 2026-10-05
An Euler pseudoprime is an odd composite number with satisfying , where the right side is the Jacobi symbol. A weaker convention requires only ; it is distinguished below. A strong pseudoprime, with and odd, satisfies or for some .
By the Chinese remainder theorem for unit groups, the unit group modulo is . Modulo , . Thus the only possible sign in is positive. Modulo , writing for a primitive root, the condition is , equivalently . Consequently has multiplicative order dividing in each factor. Its square is either or in each factor, but these signs must agree: modulo , the Legendre symbol is for square and for square , and the same is true modulo . The Euler pseudoprime condition additionally requires the product of those Legendre symbols to be . HenceEach sign has two roots modulo each prime, hence four roots modulo . There are eight pseudoprime bases modulo under the Jacobi symbol convention. Under the weaker sign-only convention there are instead sixteen pseudoprime bases, since the two signs of the squares need not agree; the stated equivalence therefore specifically uses the Jacobi symbol convention.
For the strong pseudoprime condition, . Since the unit group has exponent of a finite group , the only possibilities are or . The six pseudoprime bases are . For example , while has but . Thus the strong-pseudoprime pseudoprime bases are not a subgroup.
Past exam of the mathematics course of the University of Cambridge 2023 ii Paper 2 1G Solution Created 2026-09-23 Updated 2026-10-03
The Lagrange root bound over a field says that a nonzero polynomial of degree over a field has at most roots. In particular, a polynomial modular congruence of degree modulo a prime number has at most incongruent solutions unless all its coefficients vanish modulo that prime.
Suppose that is good and that the positive integer divisor divides . The roots of form a finite multiplicative subgroup of . By the fact that every finite multiplicative subgroup of a field is cyclic, is a cyclic group of order . The solutions in of areso there are at least of them. The Lagrange root bound over a field gives at most roots in all of , hence exactly . Thus every divisor of a good number is good.
Now put . By the Chinese remainder theorem for unit groups, a base is a Fermat-pseudoprime base precisely when its two components satisfyThe power roots in a finite field andshow that each component has ten choices. Therefore there areFermat-pseudoprime bases.
To impose the strong pseudoprime condition, write with odd. Since , we have . In each cyclic group of ten Fermat components, raising to the th power sends five elements to and five elements to . A pair of components passes the strong test exactly when their signs agree: the pair satisfies the first alternative, and satisfies the second at . Components of opposite sign become after squaring and can never jointly equal . Hence the number of strong-pseudoprime bases is
Strong-pseudoprime bases for a product of two primes with common predecessor divisor ten Created 2026-09-24 Updated 2026-09-24
Let for distinct odd prime numbers with . Exactly unit bases make a Fermat pseudoprime, and exactly of these make it a strong pseudoprime. The Fermat bases form under the Chinese remainder theorem for unit groups. If , then and is odd, so the th-power map sends five elements of each to and five to . The strong condition requires equal signs in both components, giving .