The numbers that fool every base
Worth reading first: The exponent that is smaller than Euler's · An order that proves a prime.
Necklaces that prove a theorem showed why for every prime , and the exponent that is smaller than Euler’s found the composite numbers that obey the same congruence for every base: the Carmichael numbers. Alwin Korselt characterised them in 1899 without finding one — is such a number exactly when it is squarefree and divides for every prime dividing — and Robert Carmichael found the first, 561, in 1910. That essay built a few from three primes chosen to fit. This one asks how many there are.
The question has a definite history. For eighty years after Carmichael it was not known whether there were infinitely many. William Alford, Andrew Granville and Carl Pomerance proved in 1994 that there are, and that their number up to eventually exceeds . How many there really are is still a measurement, and the measurement disagrees sharply with the best heuristic anyone has.
Korselt’s criterion, row by row
The table shows why the criterion works. For , the numbers , and all divide . By Fermat’s theorem , and for every not divisible by those primes. Since each exponent divides 560, modulo each of the three primes, and therefore modulo their product. No base coprime to 561 can expose it.
Every row of the table works the same way, and every row has at least three prime factors. Two cannot work. If with , then , and for to divide this it would have to divide , which is smaller. Squarefreeness is forced as well. If divided , the multiplicative group modulo has an element of order , and does not divide .
So finding Carmichael numbers is a sieve problem. For every odd up to some bound, factor it, check that it is squarefree with at least three prime factors, and check the divisibilities. With a table of smallest prime factors for every number up to ten million, that takes about a second, and it finds 105 Carmichael numbers below . That matches the published count exactly, as do the intermediate counts of 1, 7, 16 and 43 below to .
What the group of units sees
Korselt’s criterion has a cleaner form in the language of the exponent that is smaller than Euler’s. The residues coprime to form a group under multiplication, and the smallest exponent that sends every one of them to 1 is Carmichael’s function. For a prime the group is cyclic, generated by a residue whose powers are all of them, so . For a squarefree product of primes the group splits into the product of the groups for each prime, and is the least common multiple of the numbers .
So a squarefree fools every base exactly when divides . For 561 the least common multiple of 2, 10 and 16 is 80, which divides 560 seven times. For a prime itself, , and the condition is automatic. A Carmichael number is a composite whose group of units has an exponent small enough to hide inside , so that the group looks, from the point of view of exponentiation, like the group of a prime.
That makes the count a question about how often the least common multiple of the is small compared with the product of the . If the primes dividing all have built from the same few small primes, the least common multiple stays small while the product grows. That is the property the 1994 construction exploits on purpose.
How many, to ten to the twenty-first
Beyond ten million the counting needs much more careful searches. Richard Pinch, over two decades, extended the complete enumeration to by generating candidates from their prime factors rather than testing every number.
The counts run 255 below , 646 below , 1,547 below , and 20,138,200 below . On logarithmic axes they form a gently curving line. The curve rises a little more steeply as grows, so the count is growing faster than any fixed power it has passed. It overtook early and between and .
There are far fewer Carmichael numbers than primes — about primes below against twenty million Carmichael numbers. They are rare enough that a Fermat test in a random base almost never meets one by chance. They are common enough that any test used systematically will, which is why practical primality testing moved from Fermat’s test to the Miller–Rabin test that the Euclid-number primes were checked with. That test has no Carmichael-like exceptions: every composite number fails it for at least three-quarters of bases.
The exponent, measured and predicted
The most informative single number is the exponent , the power of that the count equals at each size.
It rises from at through at and at to at , every step up and every step smaller than the last. The proved results say it eventually exceeds , by Alford, Granville and Pomerance, and, by Glyn Harman’s refinement of their method, eventually exceeds . The measured curve has already passed both.
Paul Erdős gave a heuristic in 1956 that predicts something completely different. He argued that the exponent should tend to one: that , so the Carmichael numbers are, on a logarithmic scale, nearly as numerous as all numbers. His argument was the construction later made rigorous in 1994. Choose a number with very many small divisors, collect the primes for which divides , and multiply subsets of them. Any product that is congruent to 1 modulo is a Carmichael number, by Korselt. If has enough divisors, there are so many such primes that many products land on 1 modulo , and the count of those products is nearly as large as .
The gap between and is not evidence against Erdős. Pomerance refined the heuristic to a precise prediction, for an explicit function that grows more slowly than any power of . The correction is so large at feasible sizes that the predicted exponent at is not far from what is measured. The exponent is predicted to approach one so slowly that no computation will ever see it get there. The measurement and the conjecture are compatible, and neither can test the other.
How the 1994 proof builds them
Alford, Granville and Pomerance turned Erdős’s sketch into a proof in three moves. First, choose a number that is a product of many small primes, so that has an enormous number of divisors. Second, show that there are many primes for which divides . A prime of the form for a divisor of is such a prime, and the theorem that every class gets its equal share of primes, in a strong quantitative form, supplies enough of them. Third, show that some product of these primes is congruent to 1 modulo .
Any such product is a Carmichael number. Each factor has dividing , and the product is 1 modulo , so divides for every factor — Korselt’s criterion. The third step is a statement about the multiplicative group modulo . When a sequence of elements of a finite group is long enough, some nonempty subsequence multiplies to the identity, and the length needed is bounded by a group constant, the Davenport constant. It is the multiplicative cousin of the theorem of Erdős, Ginzburg and Ziv that solutions that come in multiples of p proved from Chevalley and Warning’s counting: among enough elements of a finite abelian group, some nonempty selection always combines to the identity, and nothing about the elements themselves needs to be known beyond the group they live in. With far more primes than that constant, there are not just one but very many products equal to 1 modulo , and counting them gives the lower bound .
The construction explains both the many factors and the difficulty with three. The Carmichael numbers it produces are products of many primes, because the subsequence that multiplies to 1 is long, and nothing in the argument controls its length closely enough to force exactly three. It also explains why the bound is a power of rather than something close to : the step that finds primes with dividing is the weakest, and every improvement in the exponent since 1994 has come from finding more of them.
How many prime factors
The construction Erdős described multiplies many primes together, and the counts by number of factors show the drift beginning.
Below ten million, 47 Carmichael numbers have three prime factors, 55 have four, and only three have five. Pinch’s tables show the typical number of factors climbing as grows, and the three-factor ones becoming a small minority. That is the trend Erdős’s construction requires. If most Carmichael numbers are products of many primes, chosen so that their product is 1 modulo some highly divisible , then the factor count must grow.
The three-factor Carmichael numbers behave differently. Their count up to is known to be at most about , a little more than , by work of Roger Heath-Brown, and is conjectured to grow roughly like . Whether there are infinitely many Carmichael numbers with exactly three prime factors is not known. The 1994 proof produces Carmichael numbers with enormous numbers of factors, and it cannot be made to stop at three.
Fooling one base, and fooling all
A Carmichael number fools Fermat’s test in every base. A base-2 pseudoprime fools it only in base 2: an odd composite with . Every Carmichael number is one, and there are more of them.
Below ten million there are 750 base-2 pseudoprimes, of which 105 are Carmichael numbers. The share has fallen from a third at a thousand, where 561 is one of three, to 14% at ten million, and it keeps falling. Most numbers that fool base 2 do so because the order of 2 modulo each of their prime factors happens to divide . That is a property of the single base 2, and it fails for base 3 or base 5 almost every time.
The figure shows why combining a few bases works so well in practice, and why it is not quite enough in principle. Each extra base removes most of the survivors that are not Carmichael numbers, and none of those that are, so the survivors converge on exactly that set. A number that fools both base 2 and base 3 is rarer still, but the Carmichael numbers fool every combination. A test made of Fermat checks in a fixed list of bases always has exceptions, and they are the Carmichael numbers.
Chernick’s family, and the conjecture it needs
The construction in the exponent that is smaller than Euler’s was a family found by Jack Chernick in 1939: if , and are all prime, their product is a Carmichael number.
Korselt’s criterion is easy to check for the product. is divisible by , and . The first case, , gives , the third Carmichael number and Ramanujan’s taxicab number. Below there are 842 values of that work, starting .
Whether there are infinitely many is a case of Dickson’s conjecture, the statement that a set of linear forms with no fixed obstruction is simultaneously prime infinitely often — the same kind of statement as the patterns primes are allowed to make. The conjecture comes with a predicted rate: a constant times the sum of . A constant fitted at a tenth of the range predicts 850 by , against 842 found. The heuristic works as well as such heuristics usually do and is exactly as unprovable. That is why Chernick’s family could never establish infinitude, and why the 1994 proof built Carmichael numbers with many factors by an entirely different route.
What the counts cannot settle
Every count here to ten million is exact and verified against the published values, and Pinch’s counts beyond are quoted as published. What no count can settle is the limit of the exponent. The measurements show it rising and slowing, and both the proved lower bound and Erdős’s prediction fit them — the first because the exponent has passed it, the second because the predicted approach to one is slow enough to hide below , and below any size a search will ever reach.
The counts also say nothing about the structure of individual Carmichael numbers beyond their factor counts. Questions such as whether there are infinitely many Carmichael numbers in every arithmetic progression that allows them were settled by extensions of the 1994 method; others, such as whether every number of prime factors from three up occurs infinitely often, remain open. The counts cannot speak to any of them.
Still open: three factors, and the true rate
Whether there are infinitely many Carmichael numbers with exactly three prime factors is open, and it would follow from Dickson’s conjecture applied to Chernick’s family or to its relatives. The true rate of growth is open too. Erdős’s heuristic and Pomerance’s refinement predict an exponent tending to one; the proofs give a lower bound near one third; the counts give 0.348 at and no way to extrapolate.
There is also a question about the strong pseudoprimes, the composites that pass the Miller–Rabin test for a given base. Unlike Carmichael numbers, none passes for every base, but for every finite list of bases there are composites that pass all of them. The smallest such composite for the first prime bases is known for up to about thirteen. How fast it grows with governs whether a deterministic version of the test with a short list of bases can be proved correct, and that is open except under the generalised Riemann hypothesis.
Rare, infinite and still being counted
The numbers that fool Fermat’s test in every base were found in 1910, proved infinite in 1994, and counted to , where there are twenty million of them. Their count grows like a power of that has climbed from a fifth to a third, past what is proved and nowhere near what the heuristic predicts. They thin out among the base-2 pseudoprimes and gain prime factors as they grow, as the heuristic’s construction requires. The simplest family of them, Chernick’s, depends on a conjecture about primes in patterns that is as believable and as unproved as the rest. Korselt’s criterion explains why each one works, and the group of units explains why they are possible at all: a composite whose unit group has a small enough exponent looks, to every Fermat test, exactly like a prime. How many there are is still a matter of counting them, and the counting has run eleven orders of magnitude past the point where a direct sieve gives out without reaching the regime that the heuristic is about.
Shares its objects with
Essays that name at least two of the same things, and that neither author linked.
- Euclid's proof run as a machine — both name exhaustive search, open problem, primes
- A ratio nobody else has — both name exhaustive search, primes
- A sum of factorials that converges at every prime — both name heuristic, primes
- A third kind of member — both name exhaustive search, open problem
- A walk that may not step where it has been — both name exhaustive search, open problem
- Abundant, and still not a sum of its parts — both name exhaustive search, open problem
Named objects
A dashed tag is an object no other essay names yet.
Carmichael numberExhaustive searchHeuristicOpen problemPrimesPseudoprime