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
- 1Enter any integer or rational fraction a/b and choose a prime base p (2, 3, 5, 7, 11, ...).
- 2Read both the traditional left-infinite p-adic notation and the ascending power series.
- 3Inspect exact p-adic valuation v_p(x) and ultrametric norm |x|_p.
Reference Examples & Worked Benchmarks
| Rational x | Prime p | p-adic Expansion |
|---|---|---|
| −1 | p = 5 | ...444444_5 |
| 1/3 | p = 5 | ...1313132_5 |
| 1/5 | p = 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.