Katana VentraIP

Fermat's little theorem

In number theory, Fermat's little theorem states that if p is a prime number, then for any integer a, the number apa is an integer multiple of p. In the notation of modular arithmetic, this is expressed as

For other theorems named after Pierre de Fermat, see Fermat's theorem.

For example, if a = 2 and p = 7, then 27 = 128, and 128 − 2 = 126 = 7 × 18 is an integer multiple of 7.


If a is not divisible by p, that is, if a is coprime to p, then Fermat's little theorem is equivalent to the statement that ap − 1 − 1 is an integer multiple of p, or in symbols:[1][2]


For example, if a = 2 and p = 7, then 26 = 64, and 64 − 1 = 63 = 7 × 9 is a multiple of 7.


Fermat's little theorem is the basis for the Fermat primality test and is one of the fundamental results of elementary number theory. The theorem is named after Pierre de Fermat, who stated it in 1640. It is called the "little theorem" to distinguish it from Fermat's Last Theorem.[3]

Generalizations[edit]

Euler's theorem is a generalization of Fermat's little theorem: For any modulus n and any integer a coprime to n, one has





where φ(n) denotes Euler's totient function (which counts the integers from 1 to n that are coprime to n). Fermat's little theorem is indeed a special case, because if n is a prime number, then φ(n) = n − 1.


A corollary of Euler's theorem is: For every positive integer n, if the integer a is coprime with n, then for any integers x and y. This follows from Euler's theorem, since, if , then x = y + (n) for some integer k, and one has


If n is prime, this is also a corollary of Fermat's little theorem. This is widely used in modular arithmetic, because this allows reducing modular exponentiation with large exponents to exponents smaller than n.


Euler's theorem is used with n not prime in public-key cryptography, specifically in the RSA cryptosystem, typically in the following way:[10] if retrieving x from the values of y, e and n is easy if one knows φ(n).[11] In fact, the extended Euclidean algorithm allows computing the modular inverse of e modulo φ(n), that is, the integer f such that It follows that


On the other hand, if n = pq is the product of two distinct prime numbers, then φ(n) = (p − 1)(q − 1). In this case, finding f from n and e is as difficult as computing φ(n) (this has not been proven, but no algorithm is known for computing f without knowing φ(n)). Knowing only n, the computation of φ(n) has essentially the same difficulty as the factorization of n, since φ(n) = (p − 1)(q − 1), and conversely, the factors p and q are the (integer) solutions of the equation x2 – (nφ(n) + 1) x + n = 0.


The basic idea of RSA cryptosystem is thus: If a message x is encrypted as y = xe (mod n), using public values of n and e, then, with the current knowledge, it cannot be decrypted without finding the (secret) factors p and q of n.


Fermat's little theorem is also related to the Carmichael function and Carmichael's theorem, as well as to Lagrange's theorem in group theory.

Converse[edit]

The converse of Fermat's little theorem is not generally true, as it fails for Carmichael numbers. However, a slightly stronger form of the theorem is true, and it is known as Lehmer's theorem. The theorem is as follows:


If there exists an integer a such that and for all primes q dividing p − 1 one has then p is prime.


This theorem forms the basis for the Lucas primality test, an important primality test, and Pratt's primality certificate.

Burton, David M. (2011), The History of Mathematics / An Introduction (7th ed.), McGraw-Hill,  978-0-07-338315-6

ISBN

Long, Calvin T. (1972), Elementary Introduction to Number Theory (2nd ed.), Lexington: , LCCN 77171950

D. C. Heath and Company

Mahoney, Michael Sean (1994), The Mathematical Career of Pierre de Fermat, 1601–1665 (2nd ed.), Princeton University Press,  978-0-691-03666-3

ISBN

Ore, Oystein (1988) [1948], , Dover, ISBN 978-0-486-65620-5

Number Theory and Its History

Pettofrezzo, Anthony J.; Byrkit, Donald R. (1970), Elements of Number Theory, Englewood Cliffs: , LCCN 71081766

Prentice Hall

(1995). The New Book of Prime Number Records (3rd ed.). New York: Springer-Verlag. ISBN 0-387-94457-5. pp. 22–25, 49.

Paulo Ribenboim

Media related to Fermat's little theorem at Wikimedia Commons

(in Hungarian)

János Bolyai and the pseudoprimes

at cut-the-knot

Fermat's Little Theorem

at cut-the-knot

Euler Function and Theorem

Fermat's Little Theorem and Sophie's Proof

, Encyclopedia of Mathematics, EMS Press, 2001 [1994]

"Fermat's little theorem"

"Fermat's Little Theorem". MathWorld.

Weisstein, Eric W.