Carmichael function Created 2026-09-24 Updated 2026-10-20
For an integer , the Carmichael function is the exponent of a finite group for the unit group : the least positive integer for whichHere the greatest common divisor condition selects the units. Euler's totient function counts them; the Carmichael function gives their least common return exponent.[ref]
Modulo eight, the units are , and their squares are all congruent to one. Their multiplicative orders are , so although . Modulo fifteen, the units have multiplicative orders . For example, the powers of two return through . Thus although ; the multiplicative order of four is only two.
The three quantities are related byA common return exponent must be a multiple of every multiplicative order, hence of their least common multiple. Conversely, that least common multiple makes every unit return to one. Lagrange's theorem makes each multiplicative order divide the group order , proving the final divisibility. The Carmichael function applies to all units at once, while the multiplicative order concerns a chosen unit.
For the prime factorization with distinct prime numbers and , the formulas areThese are least common multiples, rather than products: . The convention handles the trivial case separately.[ref]
The Chinese remainder theorem for unit groups explains the least common multiple: a power returns to one in every prime power component exactly when it is a multiple of each component's exponent of a finite group. For an odd prime power, the unit group is a cyclic group of group order . For , the unit group modulo is a direct product of groups , generated by the classes of and five, so its exponent of a finite group is .[ref]
A Computational Introduction to Number Theory and Algebra by Victor Shoup. Section 7.5, pp. 203–205, Theorem 7.28 and its proof
This gives a uniform reduction for modular exponentiation: for a unit and a nonnegative integer , reduce modulo . For example, because . The unit hypothesis matters: , but . Computing the formula assumes the prime factorization is available. The same common-exponent viewpoint explains Carmichael numbers: a composite number passes the Fermat primality test for every unit base exactly when . For example, .
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 primality test Created 2026-10-06 Updated 2026-10-14
The Fermat test looks for a coprime base with . Such a witness proves compositeness by the Fermat little theorem, but Carmichael numbers pass for every coprime base.
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.
Korselt criterion Created 2026-09-24 Updated 2026-10-18
A composite integer is a Carmichael number if and only if it is a squarefree integer andThe criterion is named for Alwin Korselt. The two requirements are different: the first excludes repeated prime factors, while the second makes the exponent a common multiple of the prime-field return exponents.[ref]
For , the numbers divide with quotients . Thus 1105 is another Carmichael number. By contrast is squarefree, but ; a single failed divisor condition excludes it. This illustrates the appeal of the criterion: a statement about every unit becomes a small calculation using a known prime factorization.
The composite condition must be retained. A prime number is squarefree and satisfies the divisibility condition, but is excluded from the definition of a Carmichael number. The resulting certificate also depends on the supplied factors really being prime numbers; merely finding a product decomposition is insufficient.
Passing-base fraction for the Fermat test 2026-10-18
Among the units modulo , the passing residue classes form the kernel of a group homomorphism . If each trial samples independently and uniformly from those units, with replacement, the probability that trials all pass is . This statement assumes that sampling rule; it does not describe arbitrary or dependent choices of bases.
For , the Chinese remainder theorem identifies the unit group with cyclic groups of orders and . The number of solutions of is , among units. Thus . The Carmichael numbers and have passing fractions and , so their conditional false-pass probability remains one regardless of the number of independent trials.
Past exam of the mathematics course of the University of Cambridge 2004 ia Paper 4 6E Solution Created 2026-09-24 Updated 2026-10-14
For a prime number and an integer coprime to , multiplication by permutes the nonzero residue classes modulo . Indeed, implies , and none of the products is zero. Taking the product over the classes givesThe factorial is coprime to and can be cancelled, proving Fermat little theorem: .
Now and is coprime to , so it is coprime to . Since , the proved theorem givesThus the two specified integer congruences modulo are equivalent. In this particular step the additional hypothesis is not needed; it will hold for the squarefree factorization used next.
If is a squarefree integer, its distinct prime factors are pairwise coprime. Consequently divides exactly when every prime factor does. Applying the preceding equivalence with provesFinally retain this squarefree hypothesis. If divides , write . Fermat little theorem gives for every prime factor. Their pairwise coprimality then gives . For composite this is the sufficient direction of the Korselt criterion for a Carmichael number; primality is not excluded by the requested implication.
Past exam of the mathematics course of the University of Cambridge 2005 ii Paper 4 1H ii Solution Created 2026-09-24 Updated 2026-10-14
The prime factorization is , so it is composite and squarefree. Moreover , and all divide . The Korselt criterion therefore proves that 561 is a Carmichael number.
Past exam of the mathematics course of the University of Cambridge 2005 ii Paper 4 1H i Solution Created 2026-09-24 Updated 2026-10-14
By the Korselt criterion, the prime factors are distinct. There cannot be just one prime factor, since a Carmichael number is composite. If there were exactly two, write with . Then , so , impossible because . Hence at least three distinct prime factors are necessary.
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 ia Paper 4 7E Solution Created 2026-09-24 Updated 2026-10-14
Fermat's little theorem states that, for a prime number and any integer ,If , both sides vanish modulo . Otherwise multiplication by permutes the nonzero residue classes modulo : it is injective because implies by cancellation. Taking the products of these residues givesThe factorial is coprime to , so cancellation proves and hence the stated version. This proves Fermat's little theorem in both cases.
Let be a Carmichael number. If a prime square divided , choose . Since is an odd composite integer, , and . This contradicts the required modular congruence modulo . Therefore every Carmichael number is squarefree.
For each prime divisor of , choose the allowed primitive root modulo . The Carmichael identity applied to the positive integer gives , and cancellation gives . By its defining order property,Conversely, suppose a composite integer is squarefree and has this divisibility for every prime divisor. For an arbitrary integer , modulo a prime divisor there are two cases. If , then . Otherwise Fermat's little theorem and give , so again . Since the prime divisors are distinct and pairwise coprime, their product divides . This is the proof of Korselt criterion:
If for distinct odd primes with , the condition at would require . Reducing modulo gives , so . But , which is impossible. Thus a product of two distinct odd primes is not Carmichael.
For , squarefreeness is automatic. Since ,Apply the analogous reductions at and to obtainFinally , with distinct odd prime factors, andAll three divisibilities hold, so 1729 is a Carmichael number.
Past exam of the mathematics course of the University of Cambridge 2006 ii Paper 3 1H Solution Created 2026-09-24 Updated 2026-10-14
For every prime factor of , Fermat's little theorem gives . Since divides the least common multiple , it follows that . The primes are distinct and hence pairwise coprime, so their product divides this integer. ThusFor the specified product, and . Since , raising the preceding modular congruence to the forty-eighth power proves for every coprime to . This is the defining phenomenon of a Carmichael number.
Past exam of the mathematics course of the University of Cambridge 2015 ii Paper 4 9H iii Solution Created 2026-09-24 Updated 2026-10-06
False. The Carmichael number supplies a counterexample. For every coprime to , the Fermat little theorem gives modulo each of these primes, since all divide . The Chinese remainder theorem then gives . Thus the proposed Fermat primality test can fail to detect a composite for every coprime base.
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 2026 ii Paper 4 1G Solution Created 2026-09-24 Updated 2026-09-25
A Carmichael number is a composite such that for every coprime to . For , choose by CRT a number whose residue mod is a primitive root; its order divides . If , choose instead a primitive root modulo ; then , impossible because . Thus is square-free. Write . Since , also ; compositeness gives , hence and . This is Korselt criterion.
Euler's theorem states that whenever , where counts the invertible residue classes. For each prime-power divisor, the same theorem gives . Since the exponent defined in the source is a multiple of every one of these exponents, raising that congruence to the corresponding integer power givesThe prime powers are pairwise coprime, so their product divides , proving the congruence modulo .
For the displayed composite integer,Thus every integer coprime to 561 satisfies . This is a Carmichael number. The source's prime-power least common multiple need not be the minimal universal exponent for all moduli; for powers of two its definition can exceed the usual Carmichael function. No minimality claim is needed here.
Euler's theorem states that if , then , where is Euler's totient function. This includes Fermat's little theorem when is prime.
For each prime-power factor , the integer divides the defined least common multiple . Euler's theorem modulo that prime power therefore givesThe prime powers are pairwise coprime, so their product divides . Equivalently the Chinese remainder theorem givesFor the specified composite integer,Raising to the seventh power provesThus 561 is a Carmichael number. We use exactly the source's definition of as the least common multiple of prime-power totients; its validity here does not require replacing it by a smaller exponent at powers of two.
Proof of Korselt criterion Created 2026-10-14 Updated 2026-10-18
For sufficiency, let be composite and squarefree, with for every prime factor . For any integer coprime to , Fermat's little theorem gives for every such . Their product is , so the Chinese remainder theorem gives the required congruence modulo .
For necessity, first rule out a repeated factor. If with and , the Chinese remainder theorem supplies and . This is coprime to . But the binomial theorem givescontradicting the Carmichael number condition. Hence is squarefree.
Now choose a primitive root modulo a prime factor . Lift it to a unit modulo by prescribing and . The Chinese remainder theorem applies because is squarefree. The Carmichael congruence implies . Since has multiplicative order , that order divides . This proves the other condition.[ref]
Carmichael Numbers and Korselt's Criterion by Keith Conrad. Theorem 2 proof, printed p. 2: repeated prime factors, primitive roots and Chinese remainder lifting
Robert Daniel Carmichael Created 2026-10-18 Updated 2026-10-24
Portrait of Robert Daniel Carmichael
. Unknown photographer (Commons field: no coneguts); file uploaded by Ferran Mir. CC BY-SA 4.0, via Wikimedia Commons. Source.


