FLINT3.7.0-dev

_fmpz_mod_poly_sqrt, fmpz_mod_poly_sqrt

Synopsis#include <flint/fmpz_mod_poly.h>
int _fmpz_mod_poly_sqrt(fmpz * s, const fmpz * p, slong len, const fmpz_mod_ctx_t ctx)source
int fmpz_mod_poly_sqrt(fmpz_mod_poly_t b, const fmpz_mod_poly_t a, const fmpz_mod_ctx_t ctx)source

If the polynomial is a perfect square, set the output to a square root and return 1; otherwise return 0 (and set b to zero). The modulus must be prime. The underscore version writes \mathit{len}/2 + 1 coefficients.

After removing an even power of x, the constant coefficient must be a square c^2 in \mathbb{F}_p; the square root is c times the power series square root of a/a_0, computed to half the length, and the result is verified by squaring. For p = 2, a is a square if and only if it is a polynomial in x^2.

Cite this page

The FLINT team, “_fmpz_mod_poly_sqrt, fmpz_mod_poly_sqrt (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_sqrt.html (generated 2026-10-20).