# Fermat's little theorem

**Topic:** Maths · Number theory  
**Page:** https://curium.ctopass.com/en/c/petit-theoreme-de-fermat  
**Updated:** 2026-09-28

## 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.

## Explore next

- [Modular arithmetic](https://curium.ctopass.com/en/c/arithmetique-modulaire.md)
- [Prime number](https://curium.ctopass.com/en/c/nombre-premier.md)
- [Fermat's Last Theorem](https://curium.ctopass.com/en/c/dernier-theoreme-de-fermat.md)
- [Mersenne prime](https://curium.ctopass.com/en/c/nombre-de-mersenne-premier.md)
- [Perfect number](https://curium.ctopass.com/en/c/nombre-parfait.md)
- [Srinivasa Ramanujan](https://curium.ctopass.com/en/c/srinivasa-ramanujan.md)
- [Bachet-Bézout theorem](https://curium.ctopass.com/en/c/theoreme-de-bachet-bezout.md)
- [Goldbach's conjecture](https://curium.ctopass.com/en/c/conjecture-de-goldbach.md)
- [Sieve of Eratosthenes](https://curium.ctopass.com/en/c/crible-d-eratosthene.md)
- [Euclid's lemma](https://curium.ctopass.com/en/c/lemme-d-euclide.md)

---

Curium — Knowledge, one question at a time.

App Store: https://apps.apple.com/fr/app/curium/id6793886587
Google Play: https://play.google.com/store/apps/details?id=com.ctopass.curium
