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/op1/op, reduced. For op=pvuop = p^v u this is p−vp^{-v} times the inverse of uu modulo pN+vp^{N + v}, computed by Hensel lifting; if N+v≤0N + v \le 0 the result is zero. Throws if op is zero.

The inverse modulo pp is computed by the extended Euclidean algorithm and lifted by the Newton iteration z←2z−uz2z \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=2p = 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-11-02).