fmpz_mod_pow_fmpz
Synopsis
#include <flint/fmpz_mod.h>int fmpz_mod_pow_fmpz(fmpz_t a, const fmpz_t b, const fmpz_t e, const fmpz_mod_ctx_t ctx)sourceSets a to b^e modulo n and returns 1, for canonical b and any integer e. If e < 0 and b is not invertible, returns 0 and leaves a undefined.
Both powering functions use fmpz_powm (GMP's mpz_powm, Montgomery multiplication with sliding windows). When fft_small is available and n has 70000 bits or more, they use generic binary or sliding-window exponentiation with fmpz_mod_mul instead, whose products then use the FFT. Exponents 0, 1 and 2 and bases 0 and 1 are handled directly. A negative exponent inverts b first.
Guides#
Cite this page
The FLINT team, “fmpz_mod_pow_fmpz (fmpz_mod.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/fmpz_mod/fmpz_mod_pow_fmpz.html (generated 2026-10-20).
@misc{flint-doc-fmpz-mod-fmpz-mod-pow-fmpz,
author = {{The FLINT team}},
title = {{fmpz\_mod\_pow\_fmpz (fmpz\_mod.h)}},
howpublished = {FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev},
year = {2026},
url = {https://flintlib.org/doc/fmpz_mod/fmpz_mod_pow_fmpz.html},
note = {Generated 2026-10-20}
}