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 b^e \bmod m for small single-limb bases b and two-limb e and m > B: the first function for b = 2, the second for three bases b_1 \le b_2 \le b_3 at once. Helpers for n_ll_is_prime.

Both m and b must be small: these functions do not support the whole two-limb range. Correctness is guaranteed if (12 m)^2 < 2^{3 \mathtt{FLINT\_BITS}} for the base-2 function and (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-10-20).