FLINT3.7.0-dev

fmpz_mod_divides

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

If the congruence ac \equiv b \pmod n has a solution, sets a to one solution in [0, n) and returns 1; otherwise returns 0 and leaves a undefined. b and c must be canonical.

With g = \gcd(c, n) = xc + yn, a solution exists if and only if g divides b, and then a = (b/g) x \bmod n is one; it is unique only if g = 1. For c = 0 a solution exists only for b = 0, and a = 0 is returned.

Guides#

Cite this page

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