The Fermat primality test is a primality test, giving a way to test if a number is a prime number, using Fermat's little theorem and modular exponentiation (see modular arithmetic).
Fermat's Little Theorem states that if a is relatively prime to a prime number p, then \(a^{p-1} \equiv 1 \bmod p\). Fermat's little theorem is not true for composite numbers generally, and so it is an excellent tool to use to test for the primality of a number. Basically, to test whether p is prime, we can see if a randomly chosen a satisfies Fermat's little theorem. This is called the Fermat primality test. If a and p do not satisfy Fermat's little theorem, we can be sure that p is not prime, and thus the test is completed. However, if a and p do satisfy Fermat's little theorem, we cannot necessarily be convinced that p is prime, as Fermat's little theorem sometimes holds when p is not prime.
Unhappily for primality testers, there are some composite numbers, called Carmichael numbers, which pass the...
This is a preview of subscription content, log in via an institution.
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2005 International Federation for Information Processing
About this entry
Cite this entry
Liskov, M. (2005). Fermat Primality Test. In: van Tilborg, H.C.A. (eds) Encyclopedia of Cryptography and Security. Springer, Boston, MA . https://doi.org/10.1007/0-387-23483-7_160
Download citation
DOI: https://doi.org/10.1007/0-387-23483-7_160
Publisher Name: Springer, Boston, MA
Print ISBN: 978-0-387-23473-1
Online ISBN: 978-0-387-23483-0
eBook Packages: Computer ScienceReference Module Computer Science and Engineering