CURIUM
How can we tell, without calculating, that 2^97 − 2 is divisible by 97?

Fermat's little theorem

How can we tell, without calculating, that 2^97 − 2 is divisible by 97?

Thanks to Fermat's Little Theorem: if p is prime, then a^p − a is a multiple of p for any integer a. With a = 2 and p = 97, the number 2^97 − 2, which has thirty digits, is divisible by 97 without division. The same applies to 5³ − 5 = 120, a multiple of 3.

MathsNumber theory

The three levels

Beginner

How can we tell, without calculating, that 2^97 − 2 is divisible by 97?

Thanks to Fermat's Little Theorem: if p is prime, then a^p − a is a multiple of p for any integer a. With a = 2 and p = 97, the number 2^97 − 2, which has thirty digits, is divisible by 97 without division. The same applies to 5³ − 5 = 120, a multiple of 3.

Intermediate

If a number passes Fermat's test, must it be prime?

No. The theorem provides a necessary condition, not a sufficient one. The number 1,729 = 7 × 13 × 19 is not prime, yet a^1728 is congruent to 1 modulo 1,729 for every a coprime to it: this is a Carmichael number. Tests based on Fermat, such as Miller-Rabin, are therefore probabilistic; a composite integer passing them is called a pseudoprime.

Expert

How long did Fermat's Little Theorem remain without published proof?

A century. Fermat stated it in a letter to Frénicle de Bessy on 18 October 1640, without proof, 'were I not afraid of being too lengthy'. Leibniz wrote a proof around 1683 but did not publish it. The first printed proof is Euler's, in 1741. The adjective 'little' first appears in 1913, in a work by Kurt Hensel.