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 aa is the square of a polynomial, set bb to a square root and return 1; otherwise return 0 (and set b=0b = 0). Requires a prime modulus. The underscore version requires len≥1\mathit{len} \ge 1, writes len/2+1\mathit{len} / 2 + 1 coefficients and does not allow aliasing.

For n=2n = 2, aa is a square exactly when its odd coefficients vanish. Otherwise the low len/2+1\mathit{len}/2 + 1 coefficients of a candidate root are computed with _nmod_poly_sqrt_series after removing an even power of xx and scaling the constant term to 1, and the candidate is accepted if its square agrees with aa 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-11-02).