FLINT3.7.0-dev

_nmod_poly_sqrt, nmod_poly_sqrt

Synopsis#include <flint/nmod_poly.h>
int _nmod_poly_sqrt(nn_ptr s, nn_srcptr p, slong len, nmod_t mod)source
int nmod_poly_sqrt(nmod_poly_t b, const nmod_poly_t a)source

If a is the square of a polynomial, set b to a square root and return 1; otherwise return 0 (and set b = 0). Requires a prime modulus. The underscore version requires \mathit{len} \ge 1, writes \mathit{len} / 2 + 1 coefficients and does not allow aliasing.

For n = 2, a is a square exactly when its odd coefficients vanish. Otherwise the low \mathit{len}/2 + 1 coefficients of a candidate root are computed with _nmod_poly_sqrt_series after removing an even power of x and scaling the constant term to 1, and the candidate is accepted if its square agrees with a in the remaining coefficients.

Cite this page

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