← LibraryThe Modern Primality Testing LandscapeEngineering · MathematicsLesson 360/385← PrevNext →
ArticlePublished 7 Aug 20262 min readBy Kevin Joginprimality provingAPR-CLECPPAKS

Modern Primality Tests

The Modern Primality Testing Landscape

The methods available for proving primality, their complexities, and which to use for a given size of candidate.

Engineering / MathematicsModern Primality Tests2 min readKV-MATH-0657

Proving primality without factoring one less or one more than the candidate requires modern methods. Three families exist, and the one that is theoretically most satisfying is the one least used.

The three families

Modern primality proving methods
MethodComplexityCertificatePractical use
Jacobi sum (APR-CL)Almost polynomial — a slowly growing exponentNone; the run must be trusted or repeatedVery fast up to a few thousand digits
Elliptic curve (ECPP)Heuristically polynomialYes, quickly verifiableThe general workhorse
AKSProvably polynomialThe run itselfNot competitive in practice

Choosing

Why certificates matter

Always test before proving

The standard sequence

  1. Trial divideRemoves most composites at negligible cost.
  2. Run Baillie-PSWSettles compositeness with near certainty.
  3. Only then proveProving methods are expensive and should never be run on a number not already known to be a probable prime.

Practical scale

Baillie-PSW is effectively instantaneous at any size encountered in practice. The Jacobi sum test handles a few thousand digits comfortably. ECPP has proved primality of numbers with tens of thousands of digits, though such runs take considerable time.

Source. Henri Cohen, A Course in Computational Algebraic Number Theory, Springer GTM 138 — 9. 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

Shanks's Square Forms Factorisation (SQUFOF)Article · MathematicsNEXT LESSON →Gauss Sums and Jacobi SumsArticle · MathematicsShanks's Class Group Factoring MethodArticle · MathematicsStructure of the Jacobi Sum Primality TestArticle · Mathematics