P-adic number (source code)

= P-adic number
{c}
{title2=$\mathbb Q_p$}
{wiki}

For a <prime number> $p$, a p-adic number is an element of the <field> $\mathbb Q_p$ obtained by completing the <rational numbers> for the <metric> $d_p(x,y)=|x-y|_p$. Here $|\cdot|_p$ is the <p-adic absolute value>. The <Cauchy-sequence construction of a metric completion> supplies limits for every <Cauchy sequence>, and <addition>, <multiplication>, and the <p-adic absolute value> extend to this <complete metric space>. The <rational numbers> form a <dense subset>. https://arxiv.org/pdf/math/0502560[Stephen William Semmes, Notes on p-adic numbers, pages 4-5]{ref}

For a concrete example with $p=2$, consider the <partial sums> of a <geometric series>:
$$
s_n=\sum_{k=0}^{n-1}2^k=2^n-1,\qquad |s_n-(-1)|_2=|2^n|_2=2^{-n}.
$$
The first values $1,3,7,15,31$ have distances $1/2,1/4,1/8,1/16,1/32$ from $-1$ in the <2-adic absolute value>. Consequently
$$
-1=\sum_{k=0}^{\infty}2^k\qquad\text{in }\mathbb Q_2.
$$
This is a statement about <convergence in a metric space> with the <2-adic absolute value>. In the ordinary <real number> <absolute value>, the same <partial sums> grow without bound. Choosing a <metric> changes which approximation errors shrink.

More generally every nonzero <P-adic number> has a unique digit expansion
$$
x=\sum_{k=m}^{\infty}a_kp^k,\qquad m\in\mathbb Z,\quad a_m\ne0,\quad a_k\in\{0,1,\ldots,p-1\}.
$$
Only finitely many negative powers occur, while positive powers can continue indefinitely. Written with the highest powers on the left, the digits extend infinitely to the left; for example the <P-adic number> $-1$ at $p=2$ is written $\ldots111_2$. The <p-adic integers> are exactly the elements with $|x|_p\leq1$, whose digit expansions use only nonnegative powers. https://math.mit.edu/classes/18.785/2021fa/LectureNotes8.pdf[Andrew V. Sutherland, Number Theory I, Lecture 8, section 8.2, Proposition 8.17]{ref}

The construction can be understood through <modular arithmetic>. Successively choose the low-order digits to agree modulo $p$, $p^2$, and higher powers. After fixing digits below $p^n$, the remaining error has <p-adic absolute value> at most $p^{-n}$; the <partial sums> form a <Cauchy sequence>, so completeness supplies a limit. If two expansions first differ at position $j$, their difference has <P-adic valuation> $j$, proving uniqueness. This turns compatible finite <congruence classes> into one exact <number>. In particular, <Hensel's lemma> upgrades suitable approximate <roots of a polynomial> modulo powers of $p$ into roots in the <p-adic integers>.