FLINT3.7.0-dev

n_ll_small_2_powmod, n_ll_small_powmod_triple

Synopsis#include <flint/ulong_extras.h>
void n_ll_small_2_powmod(nn_ptr res, nn_srcptr exp, nn_srcptr m, nn_srcptr minv)source
void n_ll_small_powmod_triple(nn_ptr res1, nn_ptr res2, nn_ptr res3, ulong b1, ulong b2, ulong b3, nn_srcptr exp, nn_srcptr m, nn_srcptr minv)source

Compute be mod mb^e \bmod m for small single-limb bases bb and two-limb ee and m>Bm > B: the first function for b=2b = 2, the second for three bases b1≤b2≤b3b_1 \le b_2 \le b_3 at once. Helpers for n_ll_is_prime.

Both mm and bb must be small: these functions do not support the whole two-limb range. Correctness is guaranteed if (12m)2<23FLINT_BITS(12 m)^2 < 2^{3 \mathtt{FLINT\_BITS}} for the base-2 function and (6b3m)2<23FLINT_BITS(6 b_3 m)^2 < 2^{3 \mathtt{FLINT\_BITS}} for the general one.

Cite this page

The FLINT team, “n_ll_small_2_powmod, n_ll_small_powmod_triple (ulong_extras.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/ulong_extras/n_ll_small_2_powmod.html (generated 2026-11-02).