How can Fermat’s little theorem help test whether a number is composite?
Fermat’s Little Theorem, proposed by the French mathematician Pierre de Fermat, provides a necessary condition for a number to be prime. It states that for any prime number and any integer that is not divisible by , must divide exactly into .12
This theorem functions as a primality test by establishing a simple rule: if a number does not divide evenly into for a chosen integer , then is definitively a composite number.12
However, the test is not sufficient to prove primality because the converse is not always true. Some composite numbers, known as pseudoprimes, also satisfy the condition of dividing into . For instance, 341 is a composite number (), yet it divides evenly into . Consequently, while the theorem is a powerful tool for identifying composite numbers, it cannot guarantee that a number is prime.12