# Fermat's little theorem

Fermat's little theorem (not to be confused with Fermat's last theorem) states that if p is a prime number, then for any integer a, will be evenly divisible by p. This can be expressed in the notation of modular arithmetic as follows:

A variant of this theorem is stated in the following form: if p is a prime and a is an integer coprime to p, then will be evenly divisible by p. In the notation of modular arithmetic:

Another way to state this is that if p is a prime number and a is any integer that does not have p as a factor, then a raised to the p-1 power will leave a remainder of 1 when divided by p.

Fermat's little theorem is the basis for the Fermat primality test.

## Examples

• 43 − 4 = 60 is divisible by 3.
• 72 − 7 = 42 is divisible by 2.
• (−3)7 − (−3) = −(2 184) is divisible by 7.
• 297 − 2 = 158 456 325 028 528 675 187 087 900 670 is divisible by 97.

## History

Pierre de Fermat first stated the theorem in a letter dated October 18, 1640 to his friend and confidant Frénicle de Bessy as the following [1]: p divides whenever p is prime and a is coprime to p.

As usual, Fermat did not prove his assertion, only stating:

Et cette proposition est généralement vraie en toutes progressions et en tous nombres premiers; de quoi je vous envoierois la démonstration, si je n'appréhendois d'être trop long.
(And this proposition is generally true for all progressions and for all prime numbers; the proof of which I would send to you, if I were not afraid to be too long.)

Euler first published a proof in 1736 in a paper entitled "Theorematum Quorundam ad Numeros Primos Spectantium Demonstratio", but Leibniz left virtually the same proof in an unpublished manuscript from sometime before 1683.

The term "Fermat's Little Theorem" was first used in 1913 in Zahlentheorie by Kurt Hensel:

Für jede endliche Gruppe besteht nun ein Fundamentalsatz, welcher der kleine Fermatsche Satz genannt zu werden pflegt, weil ein ganz spezieller Teil desselben zuerst von Fermat bewiesen worden ist."

(There is a fundamental theorem holding in every finite group, usually called Fermat's little Theorem because Fermat was the first to have proved a very special part of it.)

It was first used in English in an article by Irving Kaplansky, "Lucas's Tests for Mersenne Numbers," American Mathematical Monthly, 52 (Apr., 1945).

### Further history

Chinese mathematicians independently made the related hypothesis (sometimes called the Chinese Hypothesis) that p is a prime if and only if . It is true that if p is prime, then . This is a special case of Fermat's little theorem. However, the converse (if then p is prime) is false. Therefore, the hypothesis, as a whole, is false (for example, , but 341=11×31 is a pseudoprime. See below.).

It is widely stated that the Chinese hypothesis was developed about 2000 years before Fermat's work in the 1600s. Despite the fact that the hypothesis is partially incorrect, it is noteworthy that it may have been known to ancient mathematicians. Some, however, claim that the widely propagated belief that the hypothesis was around so early sprouted from a misunderstanding, and that it was actually developed in 1872. For more on this, see (Ribenboim, 1995).

## Proofs

Fermat explained his theorem without a proof. The first one who gave a proof was Gottfried Leibniz in a manuscript without a date, where he wrote also that he knew a proof before 1683.

See Proofs of Fermat's little theorem.

## Generalizations

A slight generalization of the theorem, which immediately follows from it, is as follows: if p is prime and m and n are positive integers with , then In this form, the theorem is used to justify the RSA public key encryption method.

Fermat's little theorem is generalized by Euler's theorem: for any modulus n and any integer a coprime to n, we have
where φ(n) denotes Euler's φ function counting the integers between 1 and n that are coprime to n. This is indeed a generalization, because if n = p is a prime number, then φ(p) = p − 1.

This can be further generalized to Carmichael's theorem.

The theorem has a nice generalization also in finite fields.

A further result from Fermat's theorem is Hannam's lemma; (p-2)! = 1 mod p, where p is any prime.

## Pseudoprimes

If a and p are coprime numbers such that is divisible by p, then p need not be prime. If it is not, then p is called a pseudoprime to base a. F. Sarrus in 1820 found 341 = 11×31 as one of the first pseudoprimes, to base 2.

A number p that is a pseudoprime to base a for every number a coprime to p is called a Carmichael number (e.g. 561).

• Fractions with prime denominators – numbers with behaviour that relates to Fermat's little theorem
• RSA – How Fermat's little theorem is essential to the Internet security

## References

Fermat's last theorem states that:

It is impossible to separate any power higher than the second into two like powers,

or, more precisely:

In mathematics, a prime number (or a prime) is a natural number which has exactly two distinct natural number divisors: 1 and itself. An infinitude of prime numbers exists, as demonstrated by Euclid in about 300 BC.
The integers (from the Latin integer, which means with untouched integrity, whole, entire) are the set of numbers including the whole numbers (0, 1, 2, 3, …) and their negatives (0, −1, −2, −3, …).
Modular arithmetic (sometimes called modulo arithmetic, or clock arithmetic) is a system of arithmetic for integers, where numbers "wrap around" after they reach a certain value — the modulus.
In mathematics, the integers a and b are said to be coprime or relatively prime if they have no common factor other than 1 and −1, or equivalently, if their greatest common divisor is 1.
Modular arithmetic (sometimes called modulo arithmetic, or clock arithmetic) is a system of arithmetic for integers, where numbers "wrap around" after they reach a certain value — the modulus.
The Fermat primality test is a probabilistic test to determine if a number is probably prime.

## Concept

Fermat's little theorem states that if p is prime and , then

If we want to test if p
Pierre de Fermat IPA: [pjɛːʁ dəfɛʁ'ma] (August 17 1601 – January 12 1665) was a French lawyer at the Parlement
October 18 is the 1st day of the year (2nd in leap years) in the Gregorian calendar. There are 0 days remaining.

## Events

16th century - 17th century - 18th century
1610s  1620s  1630s  - 1640s -  1650s  1660s  1670s
1637 1638 1639 - 1640 - 1641 1642 1643

:
Subjects:     Archaeology - Architecture -
Bernard Frénicle de Bessy (ca. 1605–1675), was a French mathematician born in Paris, wrote numerous mathematical papers, mainly in number theory and combinatorics. The Frénicle standard form, a standard representation of magic squares, is named after him.
In mathematics, the integers a and b are said to be coprime or relatively prime if they have no common factor other than 1 and −1, or equivalently, if their greatest common divisor is 1.
Leonhard Euler

Portrait by Johann Georg Brucker
Born March 15 1707
Basel, Switzerland
Died September 18 [O.S.
Gottfried Wilhelm Leibniz

Gottfried Wilhelm Leibniz
Born July 1 (June 21 Old Style) 1646
Leipzig, Electorate of Saxony
Died November 14 1716
Hannover, Hanover
Nationality German
Irving Kaplansky (March 22, 1917 – June 25, 2006) was a Canadian mathematician. He was born in Toronto, Ontario, Canada and attended the University of Toronto as an undergraduate.
François Édouard Anatole Lucas (April 4, 1842 in Amiens - October 3, 1891) was a French mathematician. Lucas is known for his study of the Fibonacci sequence. The related Lucas sequence is named after him.
A Mersenne prime is a Mersenne number that is a prime number.

In mathematics, a Mersenne number is a number that is one less than a power of two,

As of August 2007, only 44 Mersenne primes are known; the largest known prime number (232,582,657
The American Mathematical Monthly is a mathematical journal founded by Benjamin Finkel in 1894. It is currently published 10 times each year by the Mathematical Association of America.
mathematician is a person whose primary area of study and research is the field of mathematics.

## Problems in mathematics

Some people incorrectly believe that mathematics has been fully understood, but the publication of new discoveries in mathematics continues at an immense
In number theory, the Chinese hypothesis is a disproven conjecture stating that an integer n is prime if and only if it satisfies the condition that 2n−2 is divisible by n. In other words, that integer n is prime if and only if .
A pseudoprime is a probable prime (an integer which shares a property common to all prime numbers) which is not actually prime. Pseudoprimes can be classified according to which property they satisfy.
Gottfried Wilhelm Leibniz

Gottfried Wilhelm Leibniz
Born July 1 (June 21 Old Style) 1646
Leipzig, Electorate of Saxony
Died November 14 1716
Hannover, Hanover
Nationality German
8th century - 9th century - 10th century
850s  860s  870s  - 880s -  890s  900s  910s
885 886 887 - 888 - 889 890 891

:
Subjects:     Archaeology - Architecture -
bracelet. That is, we connect the two ends of the string together, and regard two strings as the same bracelet if we can rotate one string to obtain the second string; in this case we will say that the two strings are friends.
RSA is an algorithm for public-key cryptography. It was the first algorithm known to be suitable for signing as well as encryption, and one of the first great advances in public key cryptography.
Public-key cryptography, also known as asymmetric cryptography, is a form of cryptography in which a user has a pair of cryptographic keys - a public key and a private key. The private key is kept secret, while the public key may be widely distributed.