Pocklington primality test

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search

In mathematics, the Pocklington–Lehmer primality test is a primality test devised by Henry Cabourn Pocklington[1] and Derrick Henry Lehmer.[2] The test uses a partial factorization of to prove that an integer is prime.

The output of the test is a proof that is prime, proof that is composite, or that primality could not be established.

Pocklington criterion

The test relies on the Pocklington Theorem (Pocklington criterion) which is formulated as follows:

Let be an integer, and suppose there exist numbers a and q such that

q is prime, and
















Then N is prime.[3]

Proof of this theorem

Suppose N is not prime. This means there must be a prime p, where that divides N.

Therefore, which implies .

Thus there must exist an integer u with the property that






This implies:

, by (2) since
, by (4) and Fermat's little theorem

This shows that p divides in (3), and therefore this ; a contradiction.[3]

Given N, if q and a can be found that satisfy the conditions of the theorem, then N is prime. Moreover, the pair (q, a) constitute a Primality certificate. They can be quickly verified to satisfy the conditions of the theorem, confirming N as prime.

The main difficulty is finding a value of q that satisfies (1). First, it is usually difficult to find a large prime factor of a large number. Moreover, for some primes N, such a q does not exist. For example, has no suitable q because , and , which violates the inequality in (1). Given q, finding a is not nearly as difficult. [4] If N is prime, then by Fermat's little theorem, any a in the interval will satisfy (2) (however, the cases and are trivial and won't satisfy (3)). This a will satisfy (3) as long as ord(a) does not divide . Thus a randomly chosen a in the interval has a good chance of working. If a is a generator mod N, its order is and so the method is guaranteed to work for this choice.

Note: It may happen that, while searching for a value of a that satisfies equation (2), we encounter a value of a such that equation (2) is false. If this occurs (and if a is not divisible by N), then by the Fermat primality test, N is not prime. For example, let . With , we find that . This is enough to prove that N is not prime.

Generalized Pocklington method

There is a generalized version of Pocklington's theorem is more widely applicable because it does not require finding a large prime factor of ; also, it allows a different value of a to be used for each known prime factor of . [5]:Corollary 1


Factor N − 1 as N − 1 = AB, where A and B are relatively prime, , the prime factorization of A is known, but the factorization of B is not necessarily known.

If for every prime factor p of A there exists an integer so that













then N is prime.

Proof of Corollary: Let p be a prime dividing A and let be the maximum power of p dividing A. Let v be a prime factor of N. For the from the corollary set . This means and because of also .

This means that the order of is

Thus, . The same observation holds for each prime power factor of A, which implies .

Specifically, this means

If N were composite, it would necessarily have a prime factor which is less than or equal to . It has been shown that there is no such factor, which proves that N is prime.

The test

The Pocklington–Lehmer primality test follows directly from this Corollary. To use this Corollary, first find enough factors of N − 1 so the product of those factors exceeds . Call this product A. Then let B = (N − 1)/A be the remaining, unfactored portion of N − 1. It does not matter whether B is prime. We merely need to verify that no prime that divides A also divides B, that is, that A and B are relatively prime. Then, for every prime factor p of A, find an which fulfills conditions (5) and (6) of the Corollary. If such 's can be found, the Corollary implies that N is prime.

According to Koblitz, = 2 often works.[3]


Determine whether

is prime.

First, search for small prime factors of . We quickly find that


We must determine whether and meet the conditions of the Corollary. , so . Therefore, we have factored enough of to apply the Corollary. We must also verify that .

It does not matter whether B is prime (in fact, it is not).

Finally, for each prime factor p of A, use trial and error to find an ap that satisfies (5) and (6).

For , try . Raising to this high power can be done efficiently using binary exponentiation:


So, satisfies (5) but not (6). The Corollary is quite versatile, and allows different ap for each p. Trying , we find


So satisfies both (5) and (6).

For , the second prime factor of A, try :


satisfies both (5) and (6).

According to the Corollary, this completes the proof that is prime. The certificate of primality for would consist of the two pairs (2, 5) and (3, 2).

We have chosen a small prime for calculation purposes but in practice when we start factoring A we may get factors that themselves must be checked for primality. We cannot prove N is prime until we know the factors of A are prime as well. If we get a factor of A where primality is not certain, a test must also be performed on this factor. This gives rise to a so-called down-run procedure, where the primality of a number is evaluated via the primality of a series of smaller numbers.

In our example, we can say with certainty that 2 and 3 are prime, and thus we have proved our result. The primality certificate is the list of pairs, which can be quickly checked in the corollary.

If our example had given rise to a down-run sequence, the certificate would be more complicated. It would first consist of our initial round of ap's which correspond to the 'prime' factors of A; Next, for the factor(s) of A of which primality was uncertain, we would have more ap's, and so on for factors of these factors until we reach factors of which primality is certain. This can continue for many layers if the initial prime is large, but the important point is that a certificate can be produced, containing at each level the prime to be tested, and the corresponding ap's, which can easily be verified.

Extensions and variants

The 1975 paper by Brillhart, Lehmer, and Selfridge[5] gives a proof for what is shown above as the "generalized Pocklington theorem" as Theorem 4 on page 623. Additional theorems are shown which allow less factoring. This includes their Theorem 3 (a strengthening of an 1878 theorem of Proth):

Let where p is an odd prime such that . If there exists an a for which , but , then N is prime.

If N is large, it is often difficult to factor enough of to apply the above corollary. Theorem 5 of the Brillhart, Lehmer, and Selfridge paper allows a primality proof when the factored part has reached only . Many additional such theorems are presented that allow one to prove the primality of N based on the partial factorization of and .


  1. ^ H. C. Pocklington (1914–1916). "The determination of the prime or composite nature of large numbers by Fermat's theorem". Proceedings of the Cambridge Philosophical Society. 18: 29–30. 
  2. ^ D. H. Lehmer (1927). "Tests for primality by the converse of Fermat's theorem". Bull. Amer. Math. Soc. 33 (3): 327–340. doi:10.1090/s0002-9904-1927-04368-3. 
  3. ^ a b c Koblitz, Neal, A Course in Number Theory and Cryptography, 2nd Ed, Springer,1994
  4. ^ Roberto Avanzi, Henri Cohen, Christophe Doche, Gerhard Frey, Tanja Lange, Kim Nguyen, Frederik Vercauteren (2005). Handbook of Elliptic and Hyperelliptic Curve Cryptography. Boca Raton: Chapman & Hall/CRC. 
  5. ^ a b John Brillhart; D. H. Lehmer; J. L. Selfridge (April 1975). "New Primality Criteria and Factorizations of 2m ± 1". Mathematics of Computation. 29 (130): 620–647. doi:10.1090/S0025-5718-1975-0384673-1. JSTOR 2005583. 

External links

Retrieved from "https://en.wikipedia.org/w/index.php?title=Pocklington_primality_test&oldid=807800293"
This content was retrieved from Wikipedia : http://en.wikipedia.org/wiki/Pocklington_primality_test
This page is based on the copyrighted Wikipedia article "Pocklington primality test"; it is used under the Creative Commons Attribution-ShareAlike 3.0 Unported License (CC-BY-SA). You may redistribute it, verbatim or modified, providing that you comply with the terms of the CC-BY-SA