KEVOS
ArticlesServicesCase studiesAboutContact
ArticlesServicesCase studiesAboutContact
← ArticlesPollard's p−1 Method and Its RelativesEngineering · Engineering MathematicsLesson 3/7← PrevNext →
GuidePublished 6 Aug 2026Updated 13 Aug 20269 min readBy Kevin JoginComputational Number TheoryFactoringPollard P-1P+1 Method
On this page

Ask about this page

KEVOS AIPollard's p−1 Method and Its Relatives

KEVOS knowledge first · trusted web sources when needed

Skip to the main content

Mathematics•Factoring

Pollard's p−1 Method and Its Relatives

Exploiting a factor whose group order happens to be smooth — and the p+1 and Williams variants that widen the target.

  • Engineering
  • Mathematics
  • Part 4 of 8
  • 10 min read
  • KV-MATH-0052
Executive summary

A special-purpose method that is nearly free to try

If p − 1 is smooth, then for a suitable exponent M built from small prime powers, aM ≡ 1 (mod p) by Fermat, so gcd(aM − 1, n) reveals p. The method succeeds only for factors with this special property, but it costs little to attempt and is therefore standard in every pipeline. Its failure against deliberately chosen primes is exactly what motivated ECM.

Learning objectives

  • State the smoothness condition the method requires.
  • Implement both stages and explain what the second stage adds.
  • Describe the p+1 variant and when it applies.
  • Explain the implications for cryptographic prime selection.
  • Position the method relative to ECM.

Section 01The first stage

AlgorithmPollard p−1, stage onein: n, bound B1  →  out: a factor p with p−1 B1-smooth
  1. Choose a smoothness bound B1 and a base a, commonly 2.
  2. Set M ← ∏ q⌊logq B1⌋ over primes q ≤ B1. M is divisible by every B1-smooth number.
  3. Compute x ← aM mod n, accumulating the exponent prime by prime rather than forming M explicitly.
  4. Set g ← gcd(x − 1, n).
  5. If 1 < g < n, return g. If g = 1, increase B1 or go to stage two. If g = n, back off and retry with a smaller exponent.
Cost is one long modular exponentiation, about B1 modular multiplications. Cheap enough to run speculatively on every composite.
The g = n case

If every prime factor of n has smooth order, the GCD returns n and no information. Restart with a smaller bound, or take GCDs more frequently during the exponentiation so the factors are separated before both are absorbed.

Section 02The second stage

Stage two handles the common case where p − 1 is B1-smooth except for a single larger prime factor q between B1 and a second bound B2.

AlgorithmStage two (standard continuation)in: stage-one result, bounds B1, B2  →  out: a factor
  1. Let x be the stage-one result aM mod n.
  2. Precompute xd for the small gaps d between consecutive primes in (B1, B2]. Gaps are small and repeat, so the table is short.
  3. Step through the primes q in that range, updating xq by one table multiplication each.
  4. Accumulate the product of (xq − 1) over a batch and take a single GCD per batch.
  5. Return any non-trivial GCD found.
B2 is typically 50 to 100 times B1. Stage two costs one multiplication per prime rather than one exponentiation, so the extended range is nearly free.
The same two-stage structure appears in ECM

Stage one raises to a smooth exponent; stage two sweeps a range for one remaining large prime. ECM uses exactly this structure on an elliptic curve group, which is why the two implementations share so much code.

Section 03The p+1 method and variants

Related special-purpose methods
MethodSucceeds whenArithmetic
p − 1 (Pollard)p − 1 is smoothModular exponentiation
p + 1 (Williams)p + 1 is smoothLucas sequences
Cyclotomic variantsΦk(p) is smooth for small kArithmetic in higher extensions
ECM (Lenstra)Some curve order near p is smooth — resamplableElliptic curve group law
Why the p+1 method needs a parameter search

The Lucas sequence works in the norm-one subgroup of a quadratic extension, whose order is p + 1 only when the discriminant is a non-residue modulo p — which is unknown in advance. Several parameters must be tried, half of which land in the p − 1 case instead.

Section 04Consequences for prime selection

Because the method succeeds precisely when p − 1 is smooth, cryptographic primes are chosen so that it is not. A safe prime has p = 2q + 1 with q prime, making p − 1 maximally non-smooth.

A defence against one method only

Choosing safe primes defeats p−1 and p+1 completely, and defeats ECM not at all — ECM's group order varies with the curve and does not depend on p ± 1. Resistance to special-purpose methods must not be confused with resistance to general-purpose ones.

ReferenceFrequently asked questions

How should the bounds be chosen?

B1 sets the smoothness threshold and the cost of stage one; B2 extends the reach for one additional prime. Standard practice is to start with modest bounds, run the method as a cheap speculative stage, and escalate only if the structure of the problem suggests smoothness is likely.

Does the method work when n has several smooth factors?

It finds them all at once, returning n and thus nothing useful. Taking GCDs at intervals during the exponentiation separates the factors, because the first one to satisfy the condition is caught before the others do.

Is p-1 obsolete now that ECM exists?

No. It is far cheaper per attempt, and when p−1 happens to be smooth it succeeds immediately where ECM would need many curves. It costs one exponentiation to try, so it remains a standard early stage.

NavigateContinue in this stream

Curated next steps from this page. The site also surfaces algorithmically related reading below.

  • FactoringThe Elliptic Curve Method (ECM)
  • FactoringClassical Factoring: Trial Division, Fermat and Lehman
  • Foundational AlgorithmsModular Exponentiation and Powering Algorithms
  • PrimalityClassical Primality Proofs: Pocklington and Lehmer

ProvenanceSources and further reading

This page is an original KEVOS explanatory article. It presents the underlying mathematics — definitions, algorithms, complexity results and selection criteria — in KEVOS editorial voice. No text is reproduced from any copyrighted source. Where numerical tables are relevant, KEVOS links to live authoritative databases rather than republishing static values.

Handbook application: from concept to controlled practice

Purpose. This expanded section turns the original page into a practical handbook. It preserves the supplied material and adds a repeatable way to apply, check and review Pollard's p−1 Method and Its Relatives. It does not replace a contract, legislation, a controlled standard, competent engineering judgement or specialist advice.

The operating aim is to turn a compact mathematical statement into a usable chain of definitions, claims, examples and checks. Read the original explanation first, then use the workflow and checks below to convert knowledge into evidence.

Treat Pollard's p−1 Method and Its Relatives as a network of definitions and implications, not as a list of formulas. The working vocabulary on this page—method, section, stage, pollard's, relatives—should be made explicit before any proof or computation begins. Record the ambient set or structure, the permitted operations and the equality or equivalence relation in use. A compact theorem often changes meaning when the base field, finiteness condition, commutativity assumption or direction of an action changes.

For a proof, write the hypotheses as a checklist and mark the line at which each one is used. For a computation, state the representation of the input, the arithmetic model, the termination condition and the output invariant. For a classification problem, distinguish existence from uniqueness and distinguish an object from its representation. These separations prevent a correct local calculation from being mistaken for the general result.

A useful worked example should be small enough to inspect completely but rich enough to exercise the main mechanism. Compute the result in two ways where practical: symbolically and by substitution, structurally and numerically, or directly and through a normal form. Then include one near-miss example in which a hypothesis fails. The contrast explains why the theorem is shaped as it is and gives the reader a diagnostic pattern for later problems.

Verification is part of the mathematics. Check domains and codomains, substitute proposed solutions, test identity and zero cases, compare dimensions or cardinalities, and confirm that maps respect the required operations. In numerical work, report precision, conditioning and a residual rather than digits alone. In algorithmic work, separate mathematical correctness from implementation complexity and resource limits.

Step-by-step operating method

  1. Fix the setting. State the objects, ambient structure, notation and assumptions before manipulating symbols.
  2. Separate claims. Distinguish definitions, hypotheses, conclusions, equivalent conditions and consequences.
  3. Choose a method. Select proof, construction, calculation or algorithm according to the question actually asked.
  4. Work a small case. Use the smallest non-trivial example to expose the mechanism and test edge behaviour.
  5. Verify independently. Substitute back, check invariants, test boundary cases or use an alternative derivation.

Worked-example protocol

Illustrative method—not a source theorem. Start with a small admissible input and list the definitions it must satisfy. Carry out each transformation on a separate line, citing the property that permits it. Preserve exact values until approximation is necessary. At the end, verify the output against the original definition and one invariant such as dimension, degree, determinant, order, norm or residual. Then alter one hypothesis and observe which step ceases to be valid. This protocol creates a reusable example without inventing a theorem-specific numerical answer.

StageRecordQuality check
InputObjects, domain, notation, assumptionsEvery symbol is defined
MethodPermitted operation or cited result at each stepAll hypotheses hold
OutputExact result and representationCorrect type, domain and form
VerificationSubstitution, invariant or alternative derivationIndependent agreement
Boundary testZero, identity, degenerate or failed hypothesisScope is understood

Common failure modes and recovery actions

1. Watch for

Using a theorem without checking every hypothesis.

Recovery: Return to the governing definition or requirement and restate the decision in one sentence.

2. Watch for

Treating a suggestive example as a proof of the general case.

Recovery: Separate evidence from assumption, assign an owner and set a date for validation.

3. Watch for

Changing notation or conventions part-way through an argument.

Recovery: Run a small counterexample, boundary test, pilot or independent check before proceeding.

4. Watch for

Hiding a division-by-zero, convergence, finiteness or commutativity assumption.

Recovery: Record the consequence, decision and rationale, then update the controlled baseline.

5. Watch for

Reporting a computed result without a residual, substitution or structural check.

Recovery: Escalate when the issue affects safety, compliance, acceptance, material value or an agreed tolerance.

Review checklist

  • Can every symbol be traced to a definition or prior result?
  • Which hypothesis does each major step use?
  • Does the method cover zero, identity, degenerate and boundary cases?
  • Can the conclusion be checked by a second representation or calculation?
  • Are mandatory requirements distinguished from recommendations and illustrative values?
  • Are sources, assumptions, units, dates and versions recorded closely enough to reproduce the decision?
  • Have safety, legal, ethical, stakeholder and operational consequences been considered at the appropriate level?
  • Is there a named owner and a trigger for review, escalation, change or retirement?

Questions for deeper application

What is the most important distinction a practitioner must preserve when applying Pollard's p−1 Method and Its Relatives?

Answer with a fact or cited source where available. Where evidence is incomplete, record the assumption, consequence, responsible owner and next validation action.

Which assumption about method would change the result most if it proved false?

Answer with a fact or cited source where available. Where evidence is incomplete, record the assumption, consequence, responsible owner and next validation action.

What evidence would allow an independent reviewer to reproduce or challenge the conclusion?

Answer with a fact or cited source where available. Where evidence is incomplete, record the assumption, consequence, responsible owner and next validation action.

Which boundary, exception or failure case has not yet been tested?

Answer with a fact or cited source where available. Where evidence is incomplete, record the assumption, consequence, responsible owner and next validation action.

What must be handed over, monitored or reviewed after the immediate work is complete?

Answer with a fact or cited source where available. Where evidence is incomplete, record the assumption, consequence, responsible owner and next validation action.

Authoritative references and use notes

The sources below were selected as institutional or primary guidance for the broader practice. They support the handbook method; they do not imply that every statement or clause in a source applies to every project. Confirm the current edition, jurisdiction, contract and application before treating any requirement as mandatory.

  • MIT OpenCourseWare — Number Theory I — Massachusetts Institute of Technology. Used for algebraic and analytic number theory. Accessed 2026-08-13.
  • MIT OpenCourseWare — Algebra I — Massachusetts Institute of Technology. Used for groups, vector spaces, linear transformations and linear groups. Accessed 2026-08-13.

On this page

  1. Executive summary
  2. The first stage
  3. The second stage
  4. The p+1 method and variants
  5. Consequences for prime selection
  6. FAQ
  7. Continue in this stream
  8. Sources
Page ID
KV-MATH-0052
Taxonomy
ENG-MATH — Engineering / Mathematics
Collection
COL-CANT-001
Topic stream
CANT-FACTORING
Version
1.1.0 / content 2026.08
Last reviewed
2026-08-06

Continue learning

Shanks's SQUFOF Factoring MethodGuide · Engineering MathematicsNEXT LESSON →The Continued Fraction Factoring MethodGuide · Engineering MathematicsThe Elliptic Curve Method (ECM)Guide · Engineering MathematicsClassical Factoring: Trial Division, Fermat and LehmanGuide · Engineering Mathematics
KEVOS · Engineering, manufacturing and project improvement
ArticlesServicesCase studiesAboutContact
© 2026 KEVOS®