Carmichael number Created 2026-09-24 Updated 2026-10-18
A Carmichael number is a composite number for whichEvery unit modulo satisfies the same modular congruence supplied by Fermat's little theorem for a prime number. The name refers to Robert Daniel Carmichael. The coprime qualification is essential: a nonunit can expose a prime factor through a greatest common divisor calculation. A Carmichael number is therefore a Fermat pseudoprime to every coprime base, rather than to every nonzero residue class.[ref]
Carmichael Numbers and Korselt's Criterion by Keith Conrad. Definition 1, printed p. 1: composite input and coprime bases
For example,The factors are distinct prime numbers. Their predecessor numbers all divide , so Korselt criterion applies. More explicitly, for any integer coprime to , Fermat's little theorem givesThe Chinese remainder theorem combines these into . This proves all coprime bases pass from three short divisibility checks, rather than from a long table of sampled bases.
Equivalently, a composite is a Carmichael number exactly when for every integer , including nonunits. The equivalence follows from Korselt criterion: modulo each prime factor, either is zero or its nonzero power returns to one, and squarefreeness combines those congruences. This does not say a nonunit satisfies . For instance gives , while ; the greatest common divisor already supplies the factor three.[ref]
The Carmichael function supplies another compact description: a composite is Carmichael exactly when . For , and . In contrast, Euler's totient function gives , which does not divide . The least common return exponent, rather than the number of units, controls this test.
The obstruction is useful to know when interpreting a Fermat primality test: even checking every coprime base cannot certify primality. The passing-base fraction for the Fermat test makes this failure quantitative. Stronger primality tests require additional structure, such as the squaring conditions in a Miller-Rabin primality test.
The historical record predates the name. Václav Šimerka's 1885 paper lists on printed page 224, together with factorizations. This is an early published list of examples, independently of their later name.[ref]
Zbytky z arithmetické posloupnosti by Václav Šimerka. Zbytky z arithmetické posloupnosti, printed p. 224, §9: list beginning with 561 and 1105; archive title sheet identifies Václav Šimerka and 1885
Fermat pseudoprime Created 2026-09-24 Updated 2026-10-18
A Fermat pseudoprime is relative to its base. For example, passes base , but base yields , a Fermat witness. A Carmichael number has the stronger all-coprime-base property. This explains why finding one deceptive base and proving universal deception require different arguments.
Fermat test example 2026-10-14
For the Fermat primality test, a passing base satisfies . Passing proves only this modular congruence, not that is a prime number. An odd composite number that passes a coprime base is a Fermat pseudoprime to that base. A Carmichael number passes every coprime base, so even testing all the units would not certify that is a prime number. [ref]
Fermat's Test by Keith Conrad. Keith Conrad, Fermat's Test, pp. 5–6, Definition 4.1 and the list beginning with 561
This small table uses only the bases , each reduced modulo first. A numeric entry is : one passes, while any other numeric entry gives a Fermat witness. A "factor" entry records a proper greatest common divisor and stops before modular exponentiation. The prime/composite classification is independently established by trial division or the displayed prime factorization, not by the passing entries. These four bases are illustrative, with no asserted universal coverage or error probability.
Table 1.
Finite-base Fermat primality test examples with explicit greatest common divisor checks
. | Independent classification | |||||
|---|---|---|---|---|---|
| 2 | Prime number | Zero residue: excluded | 1 | 1 | 1 |
| 7 | Prime number | 1 | 1 | 1 | 1 |
| 15 | : composite number | 4 | Factor 3 | Factor 5 | 1 |
| 341 | : composite number | 1 | 56 | 67 | Factor 11 |
| 561 | : composite number | 1 | Factor 3 | 1 | Factor 11 |
For , and , so . Yet and , so three is a Fermat witness. One coprime base passes and another fails: being a Fermat pseudoprime depends on the base. Choosing eleven instead reveals the proper factor through .
For , every coprime base passes: each of divides , so Fermat's little theorem gives modulo each prime factor; the Chinese remainder theorem combines the three modular congruences. Equivalently, the Carmichael function gives . Bases two and five have greatest common divisor one and pass, but , and expose factors. The qualification "coprime" is therefore crucial even for a Carmichael number.
The Fermat primality test is useful because a Fermat witness can prove compositeness using repeated squaring without finding a factor. Its failure to certify a passing candidate motivates stronger primality testing methods such as the Miller-Rabin primality test.
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 2005 ii Paper 4 1H Solution 2026-10-14
An odd composite integer coprime to is a Fermat pseudoprime to base if . A Carmichael number is a composite integer satisfying this congruence for every integer coprime to . The Korselt criterion says that a composite is a Carmichael number exactly when it is squarefree and divides for every prime divisor of .
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 i Solution Created 2026-09-24 Updated 2026-10-14
Since is odd, andis a product of two odd integers greater than one. Thus is odd and composite. Also . Fermat's theorem modulo gives , and , so . This number is even; hence . Thereforeproving that is a base-two Fermat pseudoprime.
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 2018 ii Paper 4 11G b Solution Created 2026-09-24 Updated 2026-10-03
An odd composite coprime to is a Fermat pseudoprime to base when . It is a Carmichael number when this congruence holds for every coprime to .
Suppose a Carmichael number has with . The group is cyclic, so choose a residue of orderBy the Chinese remainder theorem, extend it to an integer that is congruent to modulo every other prime-power factor of . Then , and the Carmichael congruence forces the order of modulo to divide . In particular , contradicting . Therefore every Carmichael number is square-free.
Now assume is square-free. If for every , then for every coprime to , Fermat little theorem givesfor each . The Chinese remainder theorem then gives the congruence modulo , so is Carmichael.
Conversely, if is Carmichael, fix . Choose a primitive root modulo and use the Chinese remainder theorem to choose and . Then , so the order of divides . This proves the Korselt criterion in the required form:
A Carmichael number cannot have one prime factor because it is composite. If with distinct primes , the condition implies , which is impossible. Hence every Carmichael number has at least three prime factors.
Past exam of the mathematics course of the University of Cambridge 2019 ii Paper 1 1I b Solution Created 2026-09-24 Updated 2026-10-03
An odd composite number with is a Fermat pseudoprime to base whenFor , the Chinese remainder theorem for unit groups reduces this condition to congruences modulo and . Modulo , Fermat's little theorem givesso exactly when . Modulo , the unit group has order , soThe equation in the cyclic group has solutions, namely .
Past exam of the mathematics course of the University of Cambridge 2021 ii Paper 4 11I a Solution Created 2026-09-24 Updated 2026-09-25
is a Fermat pseudoprime to base when it is composite, coprime to , and . Here gives coprimality and , so .
Past exam of the mathematics course of the University of Cambridge 2022 ii Paper 3 11I b iii Solution Created 2026-09-24 Updated 2026-09-25
Suppose first that is not primitive modulo . Since it is primitive modulo , its order modulo is then , soBecause divides , the composite number satisfiesit is a Fermat pseudoprime to base and is divisible by . Thus (iii) fails.
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
Past exam of the mathematics course of the University of Cambridge 2024 ii Paper 1 1F Solution Created 2026-09-23 Updated 2026-09-25
For an odd composite and a unit modulo , is a Fermat pseudoprime to base whenIt is an Euler pseudoprime to base whenwhere the right side is the Jacobi symbol.
By the Chinese remainder theorem,and . The condition is automatic modulo and . Modulo it hassolutions. Thus there are Fermat bases, giving proportion
For the Euler condition, modulo , so the Jacobi symbol must be . The power condition is automatic modulo , while modulo it again restricts to the two solutions of . For each of those two residues, exactly half of the choices modulo and have Jacobi symbol . Hence there are Euler bases and proportion
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 .
