World Library  
Flag as Inappropriate
Email this Article

Probable prime

Article Id: WHEBN0000160560
Reproduction Date:

Title: Probable prime  
Author: World Heritage Encyclopedia
Language: English
Subject: Megaprime, Repunit, Mersenne prime, Fermat primality test, Provable prime
Publisher: World Heritage Encyclopedia

Probable prime

In number theory, a probable prime (PRP) is an integer that satisfies a specific condition that is satisfied by all prime numbers, but which is not satisfied by most composite numbers. Different types of probable primes have different specific conditions. While there may be probable primes that are composite (called pseudoprimes), the condition is generally chosen in order to make such exceptions rare.

Fermat's test for compositeness, which is based on Fermat's little theorem, works as follows: given an integer n, choose some integer a coprime to n and calculate an − 1 modulo n. If the result is different from 1, then n is composite. If the result is 1, then n is likely to be prime; n is then called a probable prime to base a. A weak probable prime to base a is an integer that is a probable prime to base a, but which is not a strong probable prime to base a (see below).

For a fixed base a, it is unusual for a composite number to be a probable prime (that is, a pseudoprime) to that base. For example, there are only 21853 pseudoprimes base 2 that are less than 25·109 (see page 1005 of [1]).


  • Properties 1
  • Variations 2
    • Example of SPRP 2.1
  • See also 3
  • External links 4
  • References 5


Probable primality is a basis for efficient primality testing algorithms, which find application in cryptography. These algorithms are usually probabilistic in nature. The idea is that while there are composite probable primes to base a for any fixed a, we may hope there exists some fixed P<1 such that for any given composite n, if we choose a randomly the probability that n is pseudoprime to base a is at most P. If we repeat this test k times, choosing a new a each time, the probability of n being pseudoprime to all the as tested is hence at most Pk, and as this decreases exponentially, only moderate k is required to make this probability negligibly small (compared to, for example, the probability of computer hardware error).

This is unfortunately false for weak probable primes, because there exist Carmichael numbers; but it is true for more refined notions of probable primality, such as strong probable primes (P = 1/4, Miller–Rabin algorithm), or Euler probable primes (P = 1/2, Solovay–Strassen algorithm).

Even when a deterministic primality proof is required, a useful first step is to test for probable primality. This can quickly eliminate (with certainty) most composites.

A PRP test is sometimes combined with a table of small pseudoprimes to quickly establish the primality of a given number smaller than some threshold.


An Euler probable prime to base a is an integer that is indicated prime by the somewhat stronger theorem that for any prime p, a(p − 1)/2 equals (\tfrac{a}{p}) modulo p, where (\tfrac{a}{p}) is the Legendre symbol. An Euler probable prime which is composite is called an Euler–Jacobi pseudoprime to base a. The smallest Euler-Jacobi pseudoprime to base 2 is 561 (see page 1004 of [1]). There are 11347 Euler-Jacobi pseudoprimes base 2 that are less than 25·109 (page 1005 of [1]).

This test may be improved by using the fact that the only square roots of 1 modulo a prime are 1 and −1. Write n = d · 2s + 1, where d is odd. The number n is a strong probable prime (SPRP) to base a if one of the following conditions holds:

a^d\equiv 1\pmod n,\;
a^{d\cdot 2^r}\equiv -1\pmod n\text{ for some }0\leq r\leq s-1. \,

A composite strong probable prime to base a is called a strong pseudoprime to base a. Every strong probable prime to base a is also an Euler probable prime to the same base, but not vice versa.

The smallest strong pseudoprime base 2 is 2047 (page 1004 of [1]). There are 4842 strong pseudoprimes base 2 that are less than 25·109 (page 1005 of [1]).

There are also Lucas probable primes, which are based on Lucas sequences. A Lucas probable prime test can be used alone. The Baillie-PSW primality test combines a Lucas test with a strong probable prime test.

Example of SPRP

To test if 97 is probably prime:

  • Step 1: Find d and s for which 96=d\cdot 2^s , where d is odd
    • Beginning with s=0, d would be 96
    • Increasing s, we see that d=3 and s=5 , since 96=3\cdot 2^5
  • Step 2: Choose a, co-prime to 97 . We will choose 2
  • Step 3: Calculate a^d \pmod{n} , i.e. 2^3 \pmod{97} . Since it isn't congruent to 1 \pmod{97}, we continue to test the next condition
  • Step 4: Calculate 2^{3\cdot 2^r} \pmod{97} for 0 \leq r < s . If it is congruent to 96 \pmod{97} , 97 is probably prime. Otherwise, 97 is definitely composite
    • r=0 : 2^3 \equiv 8 \pmod{97}
    • r=1 : 2^6 \equiv 64 \pmod{97}
    • r=2 : 2^{12} \equiv 22 \pmod{97}
    • r=3 : 2^{24} \equiv 96 \pmod{97}
  • Therefore, 97 is probably prime.

See also

External links

  • The prime glossary – Probable prime
  • The PRP Top 10000 (the largest known probable primes)


  1. ^ a b c d e  
This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a non-profit organization.

Copyright © World Library Foundation. All rights reserved. eBooks from Project Gutenberg are sponsored by the World Library Foundation,
a 501c(4) Member's Support Non-Profit Organization, and is NOT affiliated with any governmental agency or department.