FLINT3.7.0-dev

n_remove, n_remove2_precomp

Synopsis#include <flint/ulong_extras.h>
int n_remove(ulong * n, ulong p)source
int n_remove2_precomp(ulong * n, ulong p, double ppre)source

Divides *n by the largest possible power of p > 1 and returns the exponent. Requires n \ne 0. n_remove2_precomp takes ppre = n_precompute_inverse(p).

For p = 2 trailing zeros are counted. Otherwise n_remove repeatedly squares p, storing a table of powers and removing the highest power at each step, then walks back down the table. n_remove2_precomp repeatedly calls n_divrem2_precomp.

Cite this page

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