flint_mpn_divisible
#include <flint/mpn_extras.h>int flint_mpn_divisible(mp_srcptr a, mp_size_t an, mp_srcptr b, mp_size_t bn)sourceReturns 1 if divides and 0 otherwise. Requires and ; may have zero top limbs and may be zero or less than . Used by fmpz_divisible.
After the trivial cases and the 2-adic part ( with odd), one-limb use the Hensel remainder mpn_modexact_1_odd. When both the divisor and the quotient have at least 16 limbs, the operands are first screened modulo (which has nine small prime factors; flint_mpn_mod_2exp48m1): a prime dividing but not is revealed for about 60% of random pairs. Then, with : of at most FLINT_MPN_DIVEXACT_SMALL_BN limbs use _flint_mpn_divisible_small; huge operands ( FLINT_MPN_DIVEXACT_NEWTON_CUTOFF, or FLINT_MPN_DIVEXACT_UNBALANCED_CUTOFF and ) take the candidate quotient from the Newton Hensel division and form only the high part of its product with (_flint_mpn_mulhigh_known_low), the low part being known; otherwise, as in GMP's mpn_divisible_p, a Hensel division with remainder (ports of mpn_sbpi1_bdiv_qr and mpn_dcpi1_bdiv_qr, the latter from FLINT_MPN_DC_BDIV_QR_CUTOFF limbs) is done after padding so that its top limb is below that of , and divides if and only if the remainder equals .
The FLINT team, “flint_mpn_divisible (mpn_extras.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/mpn_extras/flint_mpn_divisible.html (generated 2026-11-02).
@misc{flint-doc-mpn-extras-flint-mpn-divisible,
author = {{The FLINT team}},
title = {{flint\_mpn\_divisible (mpn\_extras.h)}},
howpublished = {FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev},
year = {2026},
url = {https://flintlib.org/doc/mpn_extras/flint_mpn_divisible.html},
note = {Generated 2026-11-02}
}