Wheel factorization (source code)

= Wheel factorization

Choose a modulus $W$ that is a product of small <primes>. Every <prime> not dividing $W$ must be <coprime> to $W$, so a search can restrict candidates to the corresponding <residue classes> modulo $W$. For several <linear polynomials>, discard each <residue class> in which any required value is divisible by a selected <prime>. The surviving <residue classes> can be combined using the <Chinese remainder theorem>.