FLINT3.7.0-dev

qsieve_factor

Synopsis#include <flint/qsieve.h>
void qsieve_factor(fmpz_factor_t factors, const fmpz_t n)source

Finds a nontrivial factorisation of n, which must be composite and not a perfect power; the sign of n is multiplied into factors->sign. The bases written to factors (which should be freshly initialised) multiply to |n| with the stored exponents, but they need not be prime: the sieve splits n along the square roots it finds and stops as soon as all parts are probable primes or it runs out of square roots. Use fmpz_factor for a complete factorisation into proven primes.

If n has a small factor that turns up while the factor base is computed (a prime up to the largest factor base prime), that factor and the complete factorisation of the cofactor (by fmpz_factor_no_trial) are returned instead. The tuning parameters are read from qsieve_tune for the bit size of n.

Cite this page

The FLINT team, “qsieve_factor (qsieve.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/qsieve/qsieve_factor.html (generated 2026-10-20).