Read · 1 min
Introduction to Carmichael Numbers
When you first encountered Fermat's little theorem, you must have pondered if the reverse is true. That is, if for all integers , then is prime or not. If you see some examples by hand, you may convince yourself that must be a prime in order to hold the condition true. Unfortunately, that is not the case. There are infinitely such , which we will call Carmichael number. Here, by , we mean .
If is a composite integer so that , then is a pseudoprime base . If for all integer i.e. is a pseudoprime base for all integer , then is a Carmichael number. For one has \begin{align*} a^{n-1} & \equiv1\pmod n \end{align*} The following criterion gives us a way to determine if a number is Carmichael or not.
Korselt's Criterion A composite integer is a Carmichael number if and only if is squarefree and for any prime , we have .
Let's prove this now. We will consider .
For the sake of contradiction, assume divides if . Then for all , too. Choose and we have or , which is impossible. So, is squarefree.
For the second part, we can assume without loss of generality that . Note that, from Fermat's Little Theorem, We also have . Since this has to be true for all , we are free to choose as long as . Let's choose a primitive root of i.e. . Then \begin{align*} g^{p-1} & \equiv1\pmod p\newline g^{n-1} & \equiv1\pmod p \end{align*} Since , we must have .
Thus, the criterion is proved.
Caution: though we stated that there are infinitely many Carmichael numbers, it is not trivial. In fact, it took a long time for mathematicians to prove this fact. Alford, Granville and Pomerance proved it first in (Annals of Mathematics, , ).