← LibraryQuadratic Sieve Factor Base SelectionEngineering · MathematicsLesson 375/385← PrevNext →
ArticlePublished 7 Aug 20262 min readBy Kevin Joginquadratic sievefactor basequadratic residuemultiplier

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.

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.

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.

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

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.

Continue learning

ECM Stage Two and Practical TuningArticle · MathematicsNEXT LESSON →The Quadratic Sieve: Sieving StageArticle · MathematicsThe Elliptic Curve Method: Stage OneArticle · MathematicsThe Multiple Polynomial Quadratic SieveArticle · Mathematics