FLINT3.7.0-dev

padic_inv

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

Sets rop to 1/op, reduced. For op = p^v u this is p^{-v} times the inverse of u modulo p^{N + v}, computed by Hensel lifting; if N + v \le 0 the result is zero. Throws if op is zero.

The inverse modulo p is computed by the extended Euclidean algorithm and lifted by the Newton iteration z \gets 2z - u z^2, which doubles the number of correct digits in each step (Hensel lifting of inverses, square roots and Teichmüller lifts). For p = 2 the iteration runs directly on the limbs (fmpz_invmod_2exp).

Guides#

Cite this page

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