FLINT3.7.0-dev

flint_mpn_remove_power_ascending

Synopsis#include <flint/mpn_extras.h>
mp_size_t flint_mpn_remove_power_ascending(mp_ptr x, mp_size_t xsize, mp_ptr p, mp_size_t psize, ulong * exp)source

Divides (x, \mathit{xsize}) in place by the largest power p^v of (p, \mathit{psize}) that divides it, stores v in exp and returns the new length. x must be nonzero and p > 2. The divisibility is tested by ascending squares p, p^2, p^4, \ldots, which is efficient for large powers but has a high overhead, so it should not be used as the first stage of trial division.

Cite this page

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