_nmod_poly_sqrt, nmod_poly_sqrt
#include <flint/nmod_poly.h>int nmod_poly_sqrt(nmod_poly_t b, const nmod_poly_t a)sourceIf 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.
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).
@misc{flint-doc-nmod-poly-nmod-poly-sqrt,
author = {{The FLINT team}},
title = {{\_nmod\_poly\_sqrt, nmod\_poly\_sqrt (nmod\_poly.h)}},
howpublished = {FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev},
year = {2026},
url = {https://flintlib.org/doc/nmod_poly/_nmod_poly_sqrt.html},
note = {Generated 2026-10-20}
}