Free Online Utility • MATH Studio • Exact BigInt Engine

Generate P-adic Expansions

Compute exact p-adic expansions (...d₃d₂d₁d₀)_p of integers, negative numbers, and rational fractions a/b for any prime base p, complete with p-adic valuation v_p(x), p-adic norm |x|_p, and verification.

Formula & Quick Reference Live Engine
Write x = a/b = p^v · (u/w) with p ∤ u, p ∤ w  =>  v_p(x) = v,  |x|_p = p^(-v)
At step i:  d_i = (u · w⁻¹) mod p,   u ← (u - d_i · w) / p
−1p = 5
1/3p = 5
1/5p = 2
EXACT RATIONAL p-ADIC SOLVER (ℚ_p)
p-adic Digit Expansion

        
100% client-side exact mathematics Instant

Session Calculation Log

No entries recorded in this session yet.

Complete Technical Guide to Generate P-adic Expansions

Introduced by Kurt Hensel in 1897, the p-adic numbers ℚ_p complete the rationals with respect to divisibility by a prime p instead of ordinary real magnitude. While real decimals extend infinitely to the right, p-adic integers extend infinitely to the left (...d₃d₂d₁d₀)_p!

This exact solver factors out the p-adic valuation v_p(a/b), computes the modular inverse b⁻¹ mod p, and extracts exact p-adic digits to arbitrary precision along with the non-Archimedean norm |x|_p = p^(-v_p(x)).

Exact p-adic Extraction & Norm

Write x = a/b = p^v · (u/w) with p ∤ u, p ∤ w  =>  v_p(x) = v,  |x|_p = p^(-v)
At step i:  d_i = (u · w⁻¹) mod p,   u ← (u - d_i · w) / p

In ℚ₅, −1 = ...444444₅ because 4 + 4·5 + 4·5² + ... = 4/(1 − 5) = −1, and 1/3 = ...1313132₅ because multiplying by 3 yields exact carries leaving 1 + 0·5 + 0·5² + ...!

How to Use Generate P-adic Expansions

  1. 1Enter any integer or rational fraction a/b and choose a prime base p (2, 3, 5, 7, 11, ...).
  2. 2Read both the traditional left-infinite p-adic notation and the ascending power series.
  3. 3Inspect exact p-adic valuation v_p(x) and ultrametric norm |x|_p.

Reference Examples & Worked Benchmarks

Rational xPrime pp-adic Expansion
−1p = 5...444444_5
1/3p = 5...1313132_5
1/5p = 2...11001101_2

Practical Applications & Engineering Workflows

Algebraic Number Theory

Compute Hensel-lifted expansions of negative integers and fractions in ℚ_p.

Modular Arithmetic & Coding

Inspect exact modular inverses mod p^k directly from the truncated p-adic digits.

Accuracy, Edge Cases & Best Practices

  • Every rational number has an eventually periodic p-adic expansion in ℚ_p, analogous to eventually repeating real decimals.

All calculations execute locally inside your browser using JavaScript with zero server round-trips, guaranteeing instant responsiveness and complete data privacy.

Frequently Asked Questions

Why must p be a prime number for ℚ_p?
Only when p is prime does ℚ_p form a mathematical field without zero divisors (every nonzero element has a multiplicative inverse).
Why is −1 equal to ...444444 in 5-adic numbers?
Adding 1 to ...444444₅ triggers an infinite cascade of base-5 carries to the left, leaving ...000000₅ = 0, so ...444444₅ = −1.