← LibraryThe Pocklington-Lehmer N-1 Primality TestEngineering · MathematicsLesson 353/385← PrevNext →
ArticlePublished 7 Aug 20262 min readBy Kevin JoginPocklingtonLehmerprimality proofcertificate

Classical Primality and Factoring

The Pocklington-Lehmer N-1 Primality Test

Proving primality from a partial factorisation of one less than the candidate, and the certificate this produces.

Engineering / MathematicsClassical Primality and Factoring2 min readKV-MATH-0650

The Pocklington-Lehmer test proves primality using a partial factorisation of one less than the candidate. It is the classical proving method and it produces a compact, quickly verifiable certificate.

The criterion

If a sufficiently large factored part of one less than the candidate is available, and suitable witnesses exist for each of its prime factors, the candidate is prime.

Need the factored part F with F > sqrt(n)Together with a witness for each prime factor of F.

Pocklington-Lehmer primality proving

  1. Partially factorFind prime factors of one less than the candidate until their product exceeds the square root.
  2. Find witnessesFor each such prime, find a base whose power conditions hold.
  3. Verify the conditionsA Fermat-style condition plus a GCD condition for each prime factor.
  4. ConcludeThe candidate is proven prime.

The certificate

The certificate is recursive: each prime factor used must itself be proven prime, giving a tree of certificates terminating at small primes verifiable directly.

The limitation

Where it works well

Applicability of the N-1 test
SituationWhy it works
Numbers of special formOne less than the candidate factors by construction
Constructed primesBuild the prime from known factors upward
Small candidatesThe factorisation is feasible
Random large candidatesGenerally infeasible

The N+1 variant

A dual method uses the factorisation of one more than the candidate, working with Lucas sequences instead of powers — see N+1 tests. Combining both often succeeds where neither alone does.

Relation to modern methods

The modern proving methods remove the factoring requirement. Goldwasser-Kilian replaces the multiplicative group with an elliptic curve group whose order can be chosen to be easily factored, which is exactly the flexibility the classical method lacks.

Source. Henri Cohen, A Course in Computational Algebraic Number Theory, Springer GTM 138 — 8.3. Structural reference unverified: the source file was not available during authoring; chapter and section numbers are taken from the published edition and have not been checked against a physical copy.

Continue learning

The Baillie-PSW Compositeness TestArticle · MathematicsNEXT LESSON →N+1 Tests and the Lucas-Lehmer TestArticle · MathematicsLucas Sequences and Lucas PseudoprimesArticle · MathematicsTrial Division and Lehman's MethodArticle · Mathematics