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 \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 = p^v u is a square if and only if v is even and the unit u is a square in \mathbf{Z}_p; for odd p this holds if and only if u is a square modulo p, and for p = 2 if and only if u \equiv 1 \pmod 8. The root is p^{v/2} times a square root of u modulo p^{N - v/2}, obtained from a root modulo p (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-10-20).