FLINT3.7.0-dev

fmpz_mod_inv

Synopsis#include <flint/fmpz_mod.h>
void fmpz_mod_inv(fmpz_t a, const fmpz_t b, const fmpz_mod_ctx_t ctx)source

Sets a to b^{-1} modulo n, for canonical b. Throws an exception (FLINT_IMPINV) if b is not invertible; test first with fmpz_mod_is_invertible when this is possible.

Guides#

Cite this page

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