← LibraryThe Continued Fraction Factorisation MethodEngineering · MathematicsLesson 369/385← PrevNext →
ArticlePublished 7 Aug 20262 min readBy Kevin JoginCFRACcontinued fractioncongruence of squaresfactor base

Modern Factoring Methods

The Continued Fraction Factorisation Method

CFRAC: generating small quadratic residues from the continued fraction expansion, and the congruence-of-squares framework it established.

Engineering / MathematicsModern Factoring Methods2 min readKV-MATH-0666

The continued fraction method was the first sub-exponential factoring algorithm to be practical. It established the framework — collect relations, do linear algebra, extract a congruence of squares — that the quadratic and number field sieves inherit.

The framework

If two numbers have equal squares modulo the target but are not congruent up to sign, their difference shares a non-trivial factor with the target.

x^2 = y^2 (mod n), x not congruent to plus or minus y => gcd(x - y, n) is a proper factorThe congruence-of-squares principle.

Generating small residues

The convergents of the continued fraction expansion of the square root of the target produce numerators whose squares reduce to unusually small residues.

|A_k^2 - n B_k^2| < 2 sqrt(n)The convergents give residues bounded by twice the square root.

The algorithm

The continued fraction factoring method

  1. ExpandCompute the continued fraction of the square root of the target.
  2. Collect residuesEach convergent gives a residue to test.
  3. Test smoothnessTrial divide against the factor base.
  4. Build the matrixRows are exponent vectors modulo two.
  5. Find dependenciesA kernel vector gives a product that is a perfect square.
  6. ExtractForm the congruence of squares and take a GCD.

Exponents modulo two

Why sieving beat it

Why the quadratic sieve replaced CFRAC
AspectCFRACQuadratic sieve
Residue sizeSmaller — better smoothness oddsLarger, growing across the interval
Smoothness testingIndividual trial divisionBulk sieving
Net effectSupersededMuch faster in practice

Historical importance

CFRAC factored numbers previously out of reach and demonstrated that the relation-collection framework worked. Its structure survives unchanged in every later sieve.

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

Smoothness and Sub-exponential ComplexityArticle · MathematicsNEXT LESSON →The Schnorr-Lenstra Class Group Factoring MethodArticle · MathematicsPrimality Certificates and Independent VerificationArticle · MathematicsElliptic Curves Modulo NArticle · Mathematics