nmod_divides
Synopsis
#include <flint/nmod.h>The congruence ac \equiv b \pmod n is solvable if and only if g = \gcd(c, n) divides b, and then it has exactly g solutions modulo n. nmod_divides computes u with u c \equiv g \pmod n by the extended Euclidean algorithm and returns a = (b/g)\, u \bmod n, which is not necessarily the least solution. If c = 0, then *a is set to 0, and the return value is 1 if b = 0 and 0 otherwise. When there is no solution and c \ne 0, *a is not modified.
Guides#
Cite this page
The FLINT team, “nmod_divides (nmod.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/nmod/nmod_divides.html (generated 2026-10-20).
@misc{flint-doc-nmod-nmod-divides,
author = {{The FLINT team}},
title = {{nmod\_divides (nmod.h)}},
howpublished = {FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev},
year = {2026},
url = {https://flintlib.org/doc/nmod/nmod_divides.html},
note = {Generated 2026-10-20}
}