Probable prime


In number theory, a probable prime 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, 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 that is not a multiple of n;. Calculate. If the result is not 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.
For a fixed base a, it is unusual for a composite number to be a probable prime to that base. For example, up to, there are 11,408,012,595 odd composite numbers, but only 21,853 pseudoprimes base 2. The number of odd primes in the same interval is 1,091,987,404.

Properties

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 at random, then 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.
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, or
Euler probable primes.
Even when a deterministic primality proof is required, a useful first step is to test for probable primality. This can quickly eliminate 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.

Variations

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/2 equals modulo p, where is the Jacobi 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. There are 11347 Euler-Jacobi pseudoprimes base 2 that are less than 25·109.
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 to base a if:
or
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. There are 4842 strong pseudoprimes base 2 that are less than 25·109.
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 whether 97 is a strong probable prime base 2: