KEVOS
ArticlesServicesCase studiesAboutContact
ArticlesServicesCase studiesAboutContact
← ArticlesThe Baillie-PSW Compositeness TestEngineering · Engineering MathematicsLesson 851/884← PrevNext →
ArticlePublished 7 Aug 20262 min readBy Kevin JoginBaillie PSWprobable primecombined testno known counterexample
On this page

Ask about this page

KEVOS AIThe Baillie-PSW Compositeness Test

KEVOS knowledge first · trusted web sources when needed

Classical Primality and Factoring

The Baillie-PSW Compositeness Test

The Baillie-PSW test combining a strong base-two test with a strong Lucas test, and its status as the practical standard.

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

Baillie-PSW combines a strong pseudoprime test to base two with a strong Lucas test. No composite is known to pass it, and it is the practical standard for probable-prime testing.

The test

The Baillie-PSW test

  1. Trial divideBy small primes.
  2. Check for a perfect squareThe Lucas parameter search requires it — see perfect powers.
  3. Strong test base twoA strong pseudoprime test.
  4. Select Lucas parametersBy scanning for a non-residue discriminant.
  5. Strong Lucas testSee Lucas sequences.

Why it is trusted

Key point

The two components fail on different classes of composite. A counterexample would need to be simultaneously a strong pseudoprime base two and a strong Lucas pseudoprime with parameters determined by its own residue structure, and the two conditions appear to be independent.

Status of Baillie-PSW
PropertyStatus
Counterexamples knownNone, despite extensive search
Proven to have no counterexamplesNo
Heuristic arguments for infinitely manyYes
Verified below large boundsYes, exhaustively

Caution

Heuristic arguments suggest counterexamples exist and are merely very rare and very large. The absence of a known counterexample is evidence, not proof, and the test remains a probable-prime test rather than a primality proof.

Cost

Cost

Roughly three modular exponentiations: one for the strong test and about two equivalents for the Lucas sequence. Cheaper than twenty random-base strong tests and considerably more convincing, since the components are structurally independent rather than merely repeated.

When it is not enough

For adversarial input, or where a mathematical claim depends on primality, a proof is required. See ECPP and certificates.

Note

The standard practical pattern is Baillie-PSW for routine work and a proving algorithm only where the result is published or adversarially supplied. Most cryptographic key generation uses probable primes without proof.

Combination with random bases

Some implementations add several random-base strong tests to Baillie-PSW. This guards against an adversary who has constructed a counterexample to the fixed-parameter test, at modest additional cost.

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.

Related pages

  • Fermat and Strong Pseudoprime Tests
  • Lucas Sequences and Lucas Pseudoprimes
  • The Pocklington-Lehmer N-1 Primality Test

Continue learning

Lucas Sequences and Lucas PseudoprimesArticle · Engineering MathematicsNEXT LESSON →The Pocklington-Lehmer N-1 Primality TestArticle · Engineering MathematicsFermat and Strong Pseudoprime TestsArticle · Engineering MathematicsN+1 Tests and the Lucas-Lehmer TestArticle · Engineering Mathematics
KEVOS · Engineering, manufacturing and project improvement
ArticlesServicesCase studiesAboutContact
© 2026 KEVOS®