FLINT3.7.0-dev

fmpz_factor_trial

Synopsis#include <flint/fmpz_factor.h>
int fmpz_factor_trial(fmpz_factor_t factor, const fmpz_t n, slong num_primes)source

Sets factor to the sign of n and the prime factors of n among the first num_primes primes, found with the product tree method of flint_mpn_factor_trial_tree. If the cofactor is not 1, it is appended as the last entry (with exponent 1, and not necessarily prime) and 0 is returned; otherwise 1 is returned. Requires 0 \le num_primes \le 3512 (an exception is raised otherwise). If n fits in a small fmpz, it is instead factored completely.

Cite this page

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