KEVOS
ArticlesServicesCase studiesAboutContact
ArticlesServicesCase studiesAboutContact
← ArticlesLucas Sequences and Lucas PseudoprimesEngineering · Engineering MathematicsLesson 850/884← PrevNext →
ArticlePublished 7 Aug 20262 min readBy Kevin JoginLucas sequenceLucas testprobable primecomplementary test
On this page

Ask about this page

KEVOS AILucas Sequences and Lucas Pseudoprimes

KEVOS knowledge first · trusted web sources when needed

Classical Primality and Factoring

Lucas Sequences and Lucas Pseudoprimes

Lucas sequences, the Lucas probable prime test, and why it complements the strong pseudoprime test rather than duplicating it.

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

Lucas sequences give a primality test based on a quadratic recurrence rather than on modular exponentiation. Its failure modes are different from those of the strong test, which is what makes the combination valuable.

Lucas sequences

Given parameters defining a quadratic, two integer sequences satisfy the associated linear recurrence. The Fibonacci numbers are the simplest instance.

U_(k+1) = P U_k - Q U_(k-1), similarly for VP and Q the parameters; the discriminant is P squared minus 4Q.

The test

For a prime not dividing the discriminant, a specific term of the sequence must vanish modulo that prime, with the index determined by the Jacobi symbol of the discriminant.

U_(n - (D/n)) = 0 (mod n) for prime nThe Jacobi symbol determines the index.

Key point

The test works in a quadratic extension rather than in the base field. When the discriminant is a non-residue, that extension is a genuine quadratic field, and the arithmetic there is what the strong test does not examine.

Why it complements the strong test

The two tests examine different structure
TestWorks inFailure mode
Strong pseudoprimeThe multiplicative group modulo nComposites with particular multiplicative structure
LucasA quadratic extensionComposites with particular quadratic structure

Key point

The failure modes appear to be independent, and no composite is known that passes both with the standard parameter selection. This is the basis of Baillie-PSW.

Parameter selection

The parameters must be chosen so the discriminant is a non-residue modulo the candidate. Selmer's method scans a fixed sequence of candidate discriminants and takes the first with Jacobi symbol minus one.

Pitfall

If the scan runs long without finding a non-residue, the candidate is likely a perfect square. Testing for square-ness first avoids an unbounded scan, and is cheap — see integer square roots.

Strong Lucas test

As with the Fermat test, a strong version exists that additionally examines the sequence of intermediate values. It is stronger and costs little more, and it is what Baillie-PSW actually uses.

Cost

Cost

Computing a Lucas sequence term by binary methods costs a small constant multiple of a modular exponentiation. Adding a Lucas test to a strong pseudoprime test roughly doubles the cost and buys a substantial increase in confidence — an excellent trade.

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

  • The Baillie-PSW Compositeness Test
  • Fermat and Strong Pseudoprime Tests

Continue learning

Fermat and Strong Pseudoprime TestsArticle · Engineering MathematicsNEXT LESSON →The Baillie-PSW Compositeness TestArticle · Engineering MathematicsPrimality Versus Factoring: Framing the ProblemsArticle · Engineering MathematicsThe Pocklington-Lehmer N-1 Primality TestArticle · Engineering Mathematics
KEVOS · Engineering, manufacturing and project improvement
ArticlesServicesCase studiesAboutContact
© 2026 KEVOS®