FLINT3.7.0-dev

padic_sqrt

Synopsis#include <flint/padic.h>
int padic_sqrt(padic_t rop, const padic_t op, const padic_ctx_t ctx)source

Returns whether op is a square in Qp\mathbf{Q}_p and in that case sets rop to a square root, reduced. If the return value is 0, the value of rop is undefined.

A nonzero x=pvux = p^v u is a square if and only if vv is even and the unit uu is a square in Zp\mathbf{Z}_p; for odd pp this holds if and only if uu is a square modulo pp, and for p=2p = 2 if and only if u≡1(mod8)u \equiv 1 \pmod 8. The root is pv/2p^{v/2} times a square root of uu modulo pN−v/2p^{N - v/2}, obtained from a root modulo pp (or the congruence modulo 8) by Hensel lifting of the inverse square root (Hensel lifting of inverses, square roots and Teichmüller lifts). The decision is made from the exact value of op even when the precision of rop is too small to hold a nonzero root.

Cite this page

The FLINT team, “padic_sqrt (padic.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/padic/padic_sqrt.html (generated 2026-11-02).