KEVOS
ArticlesServicesCase studiesAboutContact
ArticlesServicesCase studiesAboutContact
← ArticlesShanks's Class Group Factoring MethodEngineering · Engineering MathematicsLesson 857/884← PrevNext →
ArticlePublished 7 Aug 20262 min readBy Kevin JoginShanksclass groupambiguous formfactoring
On this page

Ask about this page

KEVOS AIShanks's Class Group Factoring Method

KEVOS knowledge first · trusted web sources when needed

Classical Primality and Factoring

Shanks's Class Group Factoring Method

Shanks's method factoring an integer by finding an ambiguous form in the class group of the corresponding discriminant.

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

Shanks's class group method factors an integer by working in the class group of a quadratic order whose discriminant involves that integer. An ambiguous form in that group reveals a factorisation.

The connection

Ambiguous forms — those equal to their own inverse — correspond to factorisations of the discriminant. Finding one therefore factors the number.

Key point

A form is ambiguous exactly when it has order dividing two in the class group. Such forms correspond to the two-torsion, and genus theory relates the two-torsion directly to the factorisation of the discriminant.

The method

Shanks's class group factoring method

  1. Choose a discriminantInvolving the number to be factored, typically a small multiple of it.
  2. Compute the class numberOr its order structure — see class numbers by forms.
  3. Find a two-torsion elementRaise a random form to the odd part of the class number.
  4. Read the factorisationAn ambiguous form gives a factor of the discriminant.

Computing the class number

The class number is found by a baby-step giant-step search in the class group, using the analytic class number formula to estimate its size and narrow the search.

Cost ~ |D|^(1/4) ~ n^(1/4)Using baby-step giant-step in a group of known approximate size.

Cost

The fourth-root complexity matches Pollard rho but with much larger constants and substantial memory requirements. It is not competitive as a general factoring method.

Why it matters

Key point

The historical importance is conceptual: it was the first method to factor by computing in an auxiliary group whose order depends on the number. That idea leads directly to Schnorr-Lenstra and, by replacing the class group with an elliptic curve group, to ECM.

Genus theory

The two-torsion of the class group is described by genus theory in terms of the prime divisors of the discriminant. This makes the correspondence between ambiguous forms and factorisations completely explicit, and it is why the method is guaranteed to work rather than merely likely to.

Relation to SQUFOF

Shanks also developed SQUFOF, which finds a square form during cycle traversal in the indefinite case. SQUFOF has the same asymptotic cost but far smaller constants and negligible memory, making it genuinely practical for small numbers.

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

  • Binary Quadratic Forms and the Ideal Correspondence
  • The Schnorr-Lenstra Class Group Factoring Method
  • The Pollard p-1 Method
  • Shanks's Square Forms Factorisation (SQUFOF)

Continue learning

The Pollard p-1 MethodArticle · Engineering MathematicsNEXT LESSON →Shanks's Square Forms Factorisation (SQUFOF)Article · Engineering MathematicsThe Pollard Rho Factoring MethodArticle · Engineering MathematicsThe Modern Primality Testing LandscapeArticle · Engineering Mathematics
KEVOS · Engineering, manufacturing and project improvement
ArticlesServicesCase studiesAboutContact
© 2026 KEVOS®