In number theory, a Carmichael number is a composite number n which in modular arithmetic satisfies the congruence relation:
bn≡b(modn) for all integers b. The relation may also be expressed in the form:
bn−1≡1(modn) for all integers b that are relatively prime to n. They are infinite in number.
They constitute the comparatively rare instances where the strict converse of Fermat's Little Theorem does not hold. This fact precludes the use of that theorem as an absolute test of primality. The Carmichael numbers form the subset K1 of the Knödel numbers. The Carmichael numbers were named after the American mathematician Robert Carmichael by Nicolaas Beeger, in 1950. Øystein Ore had referred to them in 1948 as numbers with the "Fermat property", or "F numbers" for short. The first few Carmichael numbers are:
561, 1105, 1729, 2465, 2821, 6601, 8911, 10585, 15841, 29341, 41041, 46657, 52633, 62745, 63973, 75361, 101101, 115921, 126217, 162401, 172081, 188461, 252601, 278545, 294409, 314821 ... (sequence A002997 in the OEIS)
Overview Fermat's little theorem states that if p is a prime number, then for any integer b, the number bp−b is an integer multiple of p. Carmichael numbers are composite numbers which have the same property. Carmichael numbers are also called Fermat pseudoprimes or absolute Fermat pseudoprimes. A Carmichael number will pass a Fermat primality test to every base b relatively prime to the number, even though it is not actually prime. This makes tests based on Fermat's Little Theorem less effective than strong probable prime tests such as the Baillie–PSW primality test and the Miller–Rabin primality test. However, no Carmichael number is either an Euler–Jacobi pseudoprime or a strong pseudoprime to every base relatively prime to it so, in theory, either an Euler or a strong probable prime test could prove that a Carmichael number is, in fact, composite. Arnault gives a 397-digit Carmichael number N that is a strong pseudoprime to all prime bases less than 307:
N=p⋅(313(p−1)+1)⋅(353(p−1)+1) where
p= 29674495668685510550154174642905332730771991799853043350995075531276838753171770199594238596428121188033664754218345562493168782883 is a 131-digit prime. p is the smallest prime factor of N, so this Carmichael number is also a (not necessarily strong) pseudoprime to all bases less than p. As numbers become larger, Carmichael numbers become increasingly rare. For example, there are 20138200 Carmichael numbers between 1 and 1021 (approximately one in 50 trillion (5×1013) numbers).
Korselt's criterion An alternative and equivalent definition of Carmichael numbers is given by Korselt's criterion.
Theorem (A. Korselt 1899): A positive composite integer n is a Carmichael number if and only if n is square-free, and for all prime divisors p of n, it is true that p−1∣n−1. It follows from this theorem that all Carmichael numbers are odd, since any even composite number that is square-free (and hence has only one prime factor of two) will have at least one odd prime factor, and thus p−1∣n−1 results in an even dividing an odd, a contradiction. (The oddness of Carmichael numbers also follows from the fact that −1 is a Fermat witness for any even composite number.) From the criterion it also follows that Carmichael numbers are cyclic. Additionally, it follows that there are no Carmichael numbers with exactly two prime divisors.
Discovery The first seven Carmichael numbers, from 561 to 8911, were all found by the Czech mathematician Václav Šimerka in 1885 (thus preceding not just Carmichael but also Korselt, although Šimerka did not find anything like Korselt's criterion). His work, published in Czech scientific journal Časopis pro pěstování matematiky a fysiky, however, remained unnoticed. Korselt was the first who observed the basic properties of Carmichael numbers, but he did not give any examples. That 561 is a Carmichael number can be seen with Korselt's criterion. The first seven Carmichael numbers are (sequence A002997 in the OEIS):
561=3⋅11⋅17(2∣ 560;10∣ 560;16∣ 560) 1105=5⋅13⋅17(4∣1104;12∣1104;16∣1104) 1729=7⋅13⋅19(6∣1728;12∣1728;18∣1728) 2465=5⋅17⋅29(4∣2464;16∣2464;28∣2464) 2821=7⋅13⋅31(6∣2820;12∣2820;30∣2820) 6601=7⋅23⋅41(6∣6600;22∣6600;40∣6600) 8911=7⋅19⋅67(6∣8910;18∣8910;66∣8910). In 1910, Carmichael himself also published the smallest such number, 561, and the numbers were later named after him. Jack Chernick proved a theorem in 1939 which can be used to construct a subset of Carmichael numbers. The number (6k+1)(12k+1)(18k+1) is a Carmichael number if its three factors are all prime. Whether this formula produces an infinite quantity of Carmichael numbers is an open question (though it is implied by Dickson's conjecture). Paul Erdős heuristically argued there should be infinitely many Carmichael numbers. In 1994, W. R. (Red) Alford, Andrew Granville and Carl Pomerance used a bound on Olson's constant to show that there really do exist infinitely many Carmichael numbers. Specifically, they showed that for sufficiently large n, there are at least n2/7 Carmichael numbers less than n. Thomas Wright proved that if a and m are relatively prime, then there are infinitely many Carmichael numbers in the arithmetic progression a+k⋅m, where k=1,2,…. In 2025, it was shown that any arithmetic progression contains either infinitely many Carmichael numbers or none at all. It is also known that for any sufficiently large N, there are infinitely many Carmichael numbers with exactly N prime divisors. In 1992, Löh and Niebuhr found some very large Carmichael numbers, including one with 1101518 factors and over 16 million digits. This has been improved to 10333229505 prime factors and 295486761787 digits, so the largest known Carmichael number is much greater than the largest known prime.
Properties
Factorizations Carmichael numbers have at least three prime factors. The first Carmichael numbers with k=3,4,5,… prime factors are (sequence A006931 in the OEIS):
The first Carmichael numbers with 4 prime factors are (sequence A074379 in the OEIS):
The second Carmichael number (1105) can be expressed as the sum of two squares in more ways than any smaller number. The third Carmichael number (1729) is the Hardy-Ramanujan Number: the smallest number that can be expressed as the sum of two cubes (of positive numbers) in two different ways.
… excerpt ends here. Continue reading the full article.


