Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Fermat primality test
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Concept== [[Fermat's little theorem]] states that if ''p'' is prime and ''a'' is not divisible by ''p'', then :<math>a^{p-1} \equiv 1 \pmod{p}.</math> If one wants to test whether ''p'' is prime, then we can pick random integers ''a'' not divisible by ''p'' and see whether the congruence holds. If it does not hold for a value of ''a'', then ''p'' is composite. This congruence is unlikely to hold for a random ''a'' if ''p'' is composite.<ref name="PSW">{{cite journal |author1 = Carl Pomerance |author-link1 = Carl Pomerance |author2 = John L. Selfridge |author-link2 = John L. Selfridge |author3 = Samuel S. Wagstaff, Jr. |author-link3 = Samuel S. Wagstaff, Jr. |title=The pseudoprimes to 25Β·10<sup>9</sup> |journal=Mathematics of Computation |date=July 1980 |volume=35 |issue=151 |pages=1003β1026 |url=//math.dartmouth.edu/~carlp/PDF/paper25.pdf |jstor=2006210 |doi=10.1090/S0025-5718-1980-0572872-7 |doi-access=free }}</ref> Therefore, if the equality does hold for one or more values of ''a'', then we say that ''p'' is [[probable prime|probably prime]]. However, note that the above congruence holds trivially for <math>a \equiv 1 \pmod{p}</math>, because the congruence relation is [[Modular arithmetic#Basic properties|compatible with exponentiation]]. It also holds trivially for <math>a \equiv -1 \pmod{p}</math> if ''p'' is odd, for the same reason. That is why one usually chooses a random ''a'' in the interval <math>1 < a < p - 1</math>. Any ''a'' such that :<math>a^{n-1} \equiv 1 \pmod{n}</math> when ''n'' is composite is known as a ''Fermat liar''. In this case ''n'' is called [[Fermat pseudoprime]] to base ''a''. If we do pick an ''a'' such that :<math>a^{n-1} \not\equiv 1 \pmod{n}</math> then ''a'' is known as a ''Fermat witness'' for the compositeness of ''n''.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)