FLINT3.7.0-dev

_fmpz_nm1_trial_factors, _fmpz_np1_trial_factors

Synopsis#include <flint/fmpz.h>
void _fmpz_nm1_trial_factors(const fmpz_t n, nn_ptr pm1, slong * num_pm1, ulong limit)source
void _fmpz_np1_trial_factors(const fmpz_t n, nn_ptr pp1, slong * num_pp1, ulong limit)source

Trial factor n - 1 (respectively n + 1) by the primes up to about limit and store the primes found in the array, setting its length. The array needs room for \log_2 n + 2 entries. A limit of a small multiple of (\log n)^3 / 10 is a reasonable choice for the tests above.

Cite this page

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