_fmpz_mod_poly_gcd, fmpz_mod_poly_gcd
#include <flint/fmpz_mod_poly.h>slong _fmpz_mod_poly_gcd(fmpz * G, const fmpz * A, slong lenA, const fmpz * B, slong lenB, const fmpz_mod_ctx_t ctx)sourcevoid fmpz_mod_poly_gcd(fmpz_mod_poly_t G, const fmpz_mod_poly_t A, const fmpz_mod_poly_t B, const fmpz_mod_ctx_t ctx)sourceSet G to the greatest common divisor of A and B, which is made monic by the non-underscore version (the gcd of two zero polynomials is zero). The underscore version requires \mathit{lenA} \ge \mathit{lenB} > 0 and space for \mathit{lenB} coefficients in G, returns the length of G and does not normalise its leading coefficient. The modulus must be prime.
For \min(\mathit{lenA}, \mathit{lenB}) < 256 the Euclidean algorithm is used (_gr_poly_gcd_euclidean), and above that the half-GCD algorithm (_gr_poly_gcd_hgcd with base case cutoff 128), in O(M(n) \log n) operations; see Half-GCD.
Guides#
The FLINT team, “_fmpz_mod_poly_gcd, fmpz_mod_poly_gcd (fmpz_mod_poly.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/fmpz_mod_poly/_fmpz_mod_poly_gcd.html (generated 2026-10-20).
@misc{flint-doc-fmpz-mod-poly-fmpz-mod-poly-gcd,
author = {{The FLINT team}},
title = {{\_fmpz\_mod\_poly\_gcd, fmpz\_mod\_poly\_gcd (fmpz\_mod\_poly.h)}},
howpublished = {FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev},
year = {2026},
url = {https://flintlib.org/doc/fmpz_mod_poly/_fmpz_mod_poly_gcd.html},
note = {Generated 2026-10-20}
}