← LibraryPrimality Versus Factoring: Framing the ProblemsEngineering · MathematicsLesson 349/385← PrevNext →
ArticlePublished 7 Aug 20262 min readBy Kevin Joginprimalityfactoringcompositenesscertificate

Classical Primality and Factoring

Primality Versus Factoring: Framing the Problems

Why proving compositeness is easy, proving primality is harder, and factoring is harder still — and what this asymmetry means in practice.

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

Primality and factoring are frequently conflated and are entirely different problems. Deciding primality is easy; producing a factor is not, and the gap between them is what public-key cryptography rests on.

Three distinct questions

The three questions and their difficulty
QuestionDifficultyTypical method
Is this number composite?EasyA single strong pseudoprime test
Is this number prime, provably?ModerateECPP or Jacobi sum
What are its factors?HardECM, MPQS or the number field sieve

The asymmetry

A strong pseudoprime test on a composite number succeeds in exposing it with probability at least three quarters per random base, so a handful of bases settles compositeness beyond practical doubt. Nothing in that process yields a factor.

Probable primes versus proven primes

Probable prime
Passes several strong pseudoprime tests. Overwhelmingly likely prime, but not proven.
Proven prime
Certified by an algorithm producing a verifiable certificate.
Industrial-grade prime
A probable prime accepted for practical use without proof. Standard in cryptography.

Practical strategy

Practical primality determination

  1. Trial divideBy small primes; disposes of most composites instantly.
  2. Strong pseudoprime testBase two first, then a few random bases.
  3. Lucas testFor a Baillie-PSW combination.
  4. Stop or proveAccept as a probable prime, or invoke a proving algorithm if certainty is required.

When factoring is needed

Factoring appears throughout this collection as a subroutine, not merely as an end in itself: discriminant factorisation for maximal orders, norm factorisation for ideal factorisation, and smoothness testing in relation collection.

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

Schoof's Point Counting AlgorithmArticle · MathematicsNEXT LESSON →Fermat and Strong Pseudoprime TestsArticle · MathematicsCurve Reduction and Tate's AlgorithmArticle · MathematicsLucas Sequences and Lucas PseudoprimesArticle · Mathematics