FLINT3.7.0-dev

n_factor_pp1, n_factor_pp1_wrapper

Synopsis#include <flint/ulong_extras.h>
ulong n_factor_pp1(ulong n, ulong B1, ulong c)source
ulong n_factor_pp1_wrapper(ulong n)source

Williams' p + 1 method [Wil1982] with prime bound B_1 and a random starting value 2 < c < n. Returns a factor, or 0 or 1 on failure. The wrapper chooses parameters tuned for 31 to 64-bit n.

Each choice of c gives another chance of success, with roughly exponentially decreasing probability. If neither p + 1 nor p - 1 is smooth for any factor p of n, the method cannot succeed.

References#

  • [Wil1982] H. C. Williams, "A p+1 method of factoring", Mathematics of Computation 39 (1982), 225–234
Cite this page

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