Fast, type-safe p-adic arithmetic.
Implementation of p-adic arithmetics on the base of fast modular arithmetics. Module introduces data types for p-adic integers and rationals with arbitrary precision as well as some specific functions (rational reconstruction, p-adic signum function, square roots etc.).
Math.NumberTheory.Padic
Module introduces p-adic integers and p-adic rational numbers of fixed and arbitratry precision, implementing basic arithmetic as well as some specific functions, i.e. detection of periodicity in digital sequence, rational reconstruction, square roots etc.
In order to gain efficiency the integer p-adic number with radix p
is internally represented in form N mod p^k
as only one digit N
, lifted to modulo p^k
, where k
is chosen so that within working precision numbers belogning to Int
and Ratio Int
types could be reconstructed by extended Euclidean algorithm. Canonical expansion is used for textual output only.