Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Fermat primality test
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
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''.
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Fermat primality test
(section)
Add topic