In number theory, a Carmichael number is a composite number which in modular arithmetic satisfies the congruence relation: formula_1 for all integers . The relation may also be expressed in the form: formula_2 for all integers formula_3 that are relatively prime to . 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 "K"1 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. Overview. Fermat's little theorem states that if formula_4 is a prime number, then for any integer , the number formula_5 is an integer multiple of . 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 formula_3 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 formula_7 that is a "strong" pseudoprime to all "prime" bases less than 307: formula_8 where formula_929674495668685510550154174642905332730771991799853043350995075531276838753171770199594238596428121188033664754218345562493168782883 is a 131-digit prime. formula_4 is the smallest prime factor of , so this Carmichael number is also a (not necessarily strong) pseudoprime to all bases less than . As numbers become larger, Carmichael numbers become increasingly rare. For example, there are 20,138,200 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 formula_11 is a Carmichael number if and only if formula_11 is square-free, and for all prime divisors formula_4 of , it is true that . 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 formula_14 results in an even dividing an odd, a contradiction. (The oddness of Carmichael numbers also follows from the fact that formula_15 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. Indeed, formula_16 is square-free and , formula_17 and . The next six Carmichael numbers are : formula_18 formula_19 formula_20 formula_21 formula_22 formula_23 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 formula_24 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 formula_11, there are at least formula_26 Carmichael numbers between 1 and . Thomas Wright proved that if formula_27 and formula_28 are relatively prime, then there are infinitely many Carmichael numbers in the arithmetic progression , where . Löh and Niebuhr in 1992 found some very large Carmichael numbers, including one with 1,101,518 factors and over 16 million digits. This has been improved to 10,333,229,505 prime factors and 295,486,761,787 digits, so the largest known Carmichael number is much greater than the largest known prime. Properties. Factorizations. Carmichael numbers have at least three positive prime factors. The first Carmichael numbers with formula_29 prime factors are : The first Carmichael numbers with 4 prime factors are : 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. Distribution. Let formula_30 denote the number of Carmichael numbers less than or equal to . The distribution of Carmichael numbers by powers of 10 : In 1953, Knödel proved the upper bound: formula_31 for some constant . In 1956, Erdős improved the bound to formula_32 for some constant . He further gave a heuristic argument suggesting that this upper bound should be close to the true growth rate of . In the other direction, Alford, Granville and Pomerance proved in 1994 that for sufficiently large "X", formula_33 In 2005, this bound was further improved by Harman to formula_34 who subsequently improved the exponent to . Regarding the asymptotic distribution of Carmichael numbers, there have been several conjectures. In 1956, Erdős conjectured that there were formula_35 Carmichael numbers for "X" sufficiently large. In 1981, Pomerance sharpened Erdős' heuristic arguments to conjecture that there are at least formula_36 Carmichael numbers up to , where . However, inside current computational ranges (such as the count of Carmichael numbers performed by Goutier up to 1022), these conjectures are not yet borne out by the data; empirically, the exponent is formula_37 for the highest available count (C(X)=49679870 for X= 1022). In 2021, Daniel Larsen proved an analogue of Bertrand's postulate for Carmichael numbers first conjectured by Alford, Granville, and Pomerance in 1994. Using techniques developed by Yitang Zhang and James Maynard to establish results concerning small gaps between primes, his work yielded the much stronger statement that, for any formula_38 and sufficiently large formula_39 in terms of formula_40, there will always be at least formula_41 Carmichael numbers between formula_39 and formula_43 Generalizations. The notion of Carmichael number generalizes to a Carmichael ideal in any number field . For any nonzero prime ideal formula_44 in , we have formula_45 for all formula_46 in {{tmath|1= {\mathcal O}_K }}, where formula_47 is the norm of the ideal {{tmath|1= \mathfrak p }}. (This generalizes Fermat's little theorem, that formula_48 for all integers {{tmath|1= m }} when {{tmath|1= p }} is prime.) Call a nonzero ideal formula_49 in formula_50 Carmichael if it is not a prime ideal and formula_51 for all {{tmath|1= \alpha \in {\mathcal O}_K }}, where formula_52 is the norm of the ideal {{tmath|1= \mathfrak a }}. When {{tmath|1= K }} is {{tmath|1= \mathbf Q }}, the ideal formula_49 is principal, and if we let {{tmath|1= a }} be its positive generator then the ideal formula_54 is Carmichael exactly when {{tmath|1= a }} is a Carmichael number in the usual sense. When {{tmath|1= K }} is larger than the rationals it is easy to write down Carmichael ideals in {{tmath|1= {\mathcal O}_K }}: for any prime number {{tmath|1= p }} that splits completely in {{tmath|1= K }}, the principal ideal formula_55 is a Carmichael ideal. Since infinitely many prime numbers split completely in any number field, there are infinitely many Carmichael ideals in {{tmath|1= {\mathcal O}_K }}. For example, if {{tmath|1= p }} is any prime number that is 1 mod 4, the ideal {{tmath|1= (p) }} in the Gaussian integers formula_56 is a Carmichael ideal. Both prime and Carmichael numbers satisfy the following equality: formula_57 Lucas–Carmichael number. A positive composite integer formula_11 is a Lucas–Carmichael number if and only if formula_11 is square-free, and for all prime divisors formula_4 of {{tmath|1= n }}, it is true that {{tmath|1= p + 1 \mid n + 1 }}. The first Lucas–Carmichael numbers are: 399, 935, 2015, 2915, 4991, 5719, 7055, 8855, 12719, 18095, 20705, 20999, 22847, 29315, 31535, 46079, 51359, 60059, 63503, 67199, 73535, 76751, 80189, 81719, 88559, 90287, ... {{OEIS|A006972}} Quasi–Carmichael number. Quasi–Carmichael numbers are squarefree composite numbers {{tmath|1= n }} with the property that for every prime factor {{tmath|1= p }} of {{tmath|1= n }}, {{tmath|1= p + b }} divides {{tmath|1= n + b }} positively with {{tmath|1= b }} being any integer besides 0. If {{tmath|1= b = -1 }}, these are Carmichael numbers, and if {{tmath|1= b = 1}}, these are Lucas–Carmichael numbers. The first Quasi–Carmichael numbers are: 35, 77, 143, 165, 187, 209, 221, 231, 247, 273, 299, 323, 357, 391, 399, 437, 493, 527, 561, 589, 598, 713, 715, 899, 935, 943, 989, 1015, 1073, 1105, 1147, 1189, 1247, 1271, 1295, 1333, 1517, 1537, 1547, 1591, 1595, 1705, 1729, ... {{OEIS|A257750}} Knödel number. An "n"-Knödel number for a given positive integer "n" is a composite number "m" with the property that each {{tmath|1= i < m }} coprime to "m" satisfies {{tmath|1= i^{m - n} \equiv 1 \pmod{m} }}. The {{tmath|1= n = 1 }} case are Carmichael numbers. Higher-order Carmichael numbers. Carmichael numbers can be generalized using concepts of abstract algebra. The above definition states that a composite integer "n" is Carmichael precisely when the "n"th-power-raising function "p""n" from the ring Z"n" of integers modulo "n" to itself is the identity function. The identity is the only Z"n"-algebra endomorphism on Z"n" so we can restate the definition as asking that "p""n" be an algebra endomorphism of Z"n". As above, "p""n" satisfies the same property whenever "n" is prime. The "n"th-power-raising function "p""n" is also defined on any Z"n"-algebra A. A theorem states that "n" is prime if and only if all such functions "p""n" are algebra endomorphisms. In-between these two conditions lies the definition of Carmichael number of order m for any positive integer "m" as any composite number "n" such that "p""n" is an endomorphism on every Z"n"-algebra that can be generated as Z"n"-module by "m" elements. Carmichael numbers of order 1 are just the ordinary Carmichael numbers. An order-2 Carmichael number. According to Howe, 17 · 31 · 41 · 43 · 89 · 97 · 167 · 331 is an order 2 Carmichael number. This product is equal to 443,372,888,629,441. Properties. Korselt's criterion can be generalized to higher-order Carmichael numbers, as shown by Howe. A heuristic argument, given in the same paper, appears to suggest that there are infinitely many Carmichael numbers of order "m", for any "m". However, not a single Carmichael number of order 3 or above is known.