KEVOS
ArticlesServicesCase studiesAboutContact
ArticlesServicesCase studiesAboutContact
← ArticlesQuadratic Sieve Factor Base SelectionEngineering · Engineering MathematicsLesson 874/884← PrevNext →
ArticlePublished 7 Aug 20262 min readBy Kevin Joginquadratic sievefactor basequadratic residuemultiplier
On this page

Ask about this page

KEVOS AIQuadratic Sieve Factor Base Selection

KEVOS knowledge first · trusted web sources when needed

Modern Factoring Methods

Quadratic Sieve Factor Base Selection

Choosing the factor base for the quadratic sieve, the quadratic residue criterion, and the multiplier.

Engineering / MathematicsModern Factoring Methods2 min readKV-MATH-0672

The quadratic sieve looks for smooth values of a quadratic polynomial. Only primes that can divide such values belong in the factor base, and that criterion halves it immediately.

The residue criterion

A prime divides a value of the polynomial only if the target is a quadratic residue modulo that prime. Primes failing this test can never appear and are excluded.

Include p <=> Legendre symbol of n modulo p equals 1Roughly half of all primes qualify.

Key point

This is the same criterion that governs prime decomposition in a quadratic field. The sieve is working in a quadratic order, and the primes in its factor base are exactly the split primes — the connection is structural, not an analogy.

Building the base

Building the quadratic sieve factor base

  1. Choose a boundBy the smoothness optimisation — see smoothness.
  2. Enumerate primesUp to that bound.
  3. Test the Legendre symbolKeep only those where the target is a residue — see symbol computation.
  4. Compute square rootsFor each retained prime, the two square roots of the target modulo it — see Shanks-Tonelli.
  5. StoreThe primes with their roots; the roots give the sieve starting positions.

Key point

The square roots are the essential precomputation. They tell the sieve exactly which positions in the interval are divisible by each prime, which is what allows sieving rather than trial division.

The multiplier

Multiplying the target by a small squarefree integer changes which primes qualify. A well-chosen multiplier admits more small primes into the base, raising the smoothness rate.

Note

The Knuth-Schroeppel function scores candidate multipliers by the expected benefit. The gain is typically a factor of two or three in overall running time, which is worth a cheap search over a few dozen candidates.

Pitfall

The multiplier must be squarefree and coprime to the target, and it must be divided out at the end. Forgetting the last step returns a factor of the multiplied number rather than of the target.

Prime powers

Higher powers of factor base primes divide values occasionally. They are handled during sieving by additional passes, or approximated by accepting slightly imprecise logarithm accumulation and catching the difference at the verification step.

Size

Cost

The base size directly sets the number of relations needed and hence the matrix dimension. For large targets the base runs to millions of primes, and the resulting matrix is the reason the linear algebra stage is a serious problem in its own right.

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

Related pages

  • Legendre, Jacobi and Kronecker Symbol Computation
  • Sub-exponential Class Group Computation for Quadratic Fields
  • Factor Base Selection and Smoothness
  • Smoothness and Sub-exponential Complexity
  • ECM Stage Two and Practical Tuning

Continue learning

ECM Stage Two and Practical TuningArticle · Engineering MathematicsNEXT LESSON →The Quadratic Sieve: Sieving StageArticle · Engineering MathematicsThe Elliptic Curve Method: Stage OneArticle · Engineering MathematicsThe Multiple Polynomial Quadratic SieveArticle · Engineering Mathematics
KEVOS · Engineering, manufacturing and project improvement
ArticlesServicesCase studiesAboutContact
© 2026 KEVOS®