FLINT3.7.0-dev

nmod_2_pow_ui

Synopsis#include <flint/nmod.h>
ulong nmod_2_pow_ui(ulong exp, nmod_t mod)source

Returns 2^{\mathit{exp}} \bmod n.

Exponents below 2^{20}, and all exponents for even n, use left-to-right binary exponentiation, in which multiplication by the base 2 is a modular doubling. Larger exponents with odd n use the same method in Montgomery arithmetic.

Cite this page

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