FLINT3.7.0-dev

flint_mpn_factor_trial_tree

Synopsis#include <flint/mpn_extras.h>
int flint_mpn_factor_trial_tree(slong * factors, mp_srcptr x, mp_size_t xsize, slong num_primes)source

Searches for factors of (x, \mathit{xsize}) among roughly the first num_primes primes, by GCDs with products of primes organised in a product tree; writes the indices in flint_primes of the primes found to factors and returns their number. Requires 0 \le num_primes \le 3512. If x fits in a small fmpz, it is factored completely instead. The product tree is computed once and cached globally (in a thread-safe way). This is the trial division used by fmpz_factor.

Cite this page

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