# Fermat's little theorem

For other theorems named after Pierre de Fermat, see .

**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

- 4
^{3}− 4 = 60 is divisible by 3. - 7
^{2}− 7 = 42 is divisible by 2. - (−3)
^{7}− (−3) = −(2 184) is divisible by 7. - 2
^{97}− 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

*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).

## See also

- 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

- Paulo Ribenboim (1995).
*The New Book of Prime Number Records*(3rd ed.). New York: Springer-Verlag. ISBN 0-387-94457-5. - János Bolyai and the pseudoprimes (in Hungarian)

## External links

- Fermat's Little Theorem at cut-the-knot
- Euler Function and Theorem at cut-the-knot
- Fermat's Little Theorem and Sophie's Proof
- Text and translation of Fermat's letter to Frenicle
- Eric W. Weisstein,
*Fermat's Little Theorem*at MathWorld.

**Fermat's last theorem**states that:

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

or, more precisely:

**.....**Click the link for more information.

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.**.....**Click the link for more information. 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, …).**.....**Click the link for more information.**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**.

**.....**Click the link for more information.

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.**.....**Click the link for more information.**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**.

**.....**Click the link for more information.

The

If we want to test if

**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 , thenIf we want to test if

*p***.....**Click the link for more information.**Pierre de Fermat**IPA: [pjɛːʁ dəfɛʁ'ma] (August 17 1601 – January 12 1665) was a French lawyer at the

*Parlement*

**.....**Click the link for more information.

October 18 is the 1st day of the year (2nd in leap years) in the Gregorian calendar. There are 0 days remaining.

## Events

**.....**Click the link for more information. 16th century -

1610s 1620s 1630s - 1640s - 1650s 1660s 1670s

1637 1638 1639 -

**17th century**- 18th century1610s 1620s 1630s - 1640s - 1650s 1660s 1670s

1637 1638 1639 -

**1640**- 1641 1642 1643**:***Subjects:*Archaeology - Architecture -**.....**Click the link for more information.**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.

**.....**Click the link for more information.

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.**.....**Click the link for more information.**Leonhard Euler**

Portrait by Johann Georg Brucker

Born March 15 1707

Basel, Switzerland

Died September 18 [O.S.

**.....**Click the link for more information.

**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

**.....**Click the link for more information.

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

**.....**Click the link for more information.

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

**.....**Click the link for more information.

A

In mathematics, a

As of August 2007, only 44 Mersenne primes are known; the largest known prime number (2

**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 (2

^{32,582,657}**.....**Click the link for more information.**is a mathematical journal founded by Benjamin Finkel in 1894. It is currently published 10 times each year by the Mathematical Association of America.**

*The American Mathematical Monthly***.....**Click the link for more information.

**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**.....**Click the link for more information.

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 2^{n}−2 is divisible by*n*. In other words, that integer*n*is prime if and only if .**.....**Click the link for more information. 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.**.....**Click the link for more information.**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

**.....**Click the link for more information.

8th century -

850s 860s 870s - 880s - 890s 900s 910s

885 886 887 -

**9th century**- 10th century850s 860s 870s - 880s - 890s 900s 910s

885 886 887 -

**888**- 889 890 891**:***Subjects:*Archaeology - Architecture -**.....**Click the link for more information.**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**.

**.....**Click the link for more information.

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

**.....**Click the link for more information.

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

**.....**Click the link for more information.

**Euler's theorem**(also known as the

**Fermat-Euler theorem**or

**Euler's totient theorem**) states that if

*n*is a positive integer and

*a*is coprime to

*n*, then

*n*) is Euler's totient function and "... ≡ ..

**.....**Click the link for more information.

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

**.....**Click the link for more information.

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.**.....**Click the link for more information.**totient**of a positive integer

*n*is defined to be the number of positive integers less than or equal to

*n*that are coprime to

*n*. For example, since the six numbers 1, 2, 4, 5, 7 and 8 are coprime to 9. The function so defined is the

**totient function**.

**.....**Click the link for more information.

This article is copied from an article on Wikipedia.org - the free encyclopedia created and edited by online user community. The text was not checked or edited by anyone on our staff. Although the vast majority of the wikipedia encyclopedia articles provide accurate and timely information please do not assume the accuracy of any particular article. This article is distributed under the terms of GNU Free Documentation License.