← Recreational maths

Lab · p-adic numbers

The p-adic integers as a fractal

Call two integers close when their difference is divisible by a high power of p. Drawn honestly, the integers become nested discs, and sequences like p, p², p³, … rush towards 0 while 1 + p + p² + ⋯ converges to a fraction.

Fix a prime $p$ and measure the size of a rational number $x \ne 0$ by $|x|_p = p^{-v_p(x)}$, where $v_p(x)$ is the exponent of $p$ in $x$. Then $|p^k|_p = p^{-k}$ is tiny, and two integers are close exactly when they agree in their last few base-$p$ digits. Completing $\mathbb{Z}$ for this distance gives the $p$-adic integers $\mathbb{Z}_p$: infinite base-$p$ expansions $\dots d_3 d_2 d_1 d_0$ extending to the left.

The picture follows the digits. The last digit $d_0$ chooses one of $p$ large discs, the digit $d_1$ chooses one of $p$ discs inside it, and so on. Points in the same small disc agree in many final digits, so they are $p$-adically close. Hensel (1897) introduced these numbers; today they sit inside almost every part of number theory.

The sequences

  • $p^k - 1 \to -1$. The base-$p$ digits of $p^k - 1$ are $k$ copies of $p - 1$, so $-1 = \dots(p{-}1)(p{-}1)(p{-}1)$ in $\mathbb{Z}_p$. For $p = 2$ this reads $-1 = \dots 1111_2$.
  • $1 + p + \dots + p^k \to \frac{1}{1-p}$. The geometric series converges because $|p|_p < 1$, and its limit is the usual formula. So $\dots 1111_p = \frac{1}{1-p}$, a negative fraction written with only the digit $1$.
  • $a^{p^k}$ converges. For $p \nmid a$, Fermat's little theorem gives $a^{p^{k+1}} \equiv a^{p^k} \pmod{p^{k+1}}$, so the sequence is Cauchy. Its limit $\omega(a)$ satisfies $\omega^{p-1} = 1$: these are the Teichmüller representatives, the $(p-1)$-st roots of unity inside $\mathbb{Z}_p$.
  • Hensel's lemma. $-1$ is a square modulo $5$ ($2^2 = 4$), and Newton's method $x \mapsto x - \frac{x^2 + 1}{2x}$ lifts the solution to $5^2, 5^3, \dots$, giving a square root of $-1$ in $\mathbb{Z}_5$. The applet does the same for $\sqrt{-7} \in \mathbb{Z}_2$, $\sqrt7 \in \mathbb{Z}_3$ and $\sqrt2 \in \mathbb{Z}_7$.
  • $k! \to 0$. By Legendre's formula $v_p(k!) \approx k/(p-1)$, so factorials are $p$-adically small. The convergence is slow, and the picture shows the terms falling into ever smaller discs around $0$.
Full proof: Hensel's lemma for a simple root

Hensel's lemma. Let $f \in \mathbb{Z}[x]$, $p$ a prime and $x_1 \in \mathbb{Z}$ with $f(x_1) \equiv 0 \pmod p$ and $f'(x_1) \not\equiv 0 \pmod p$. Then for every $k \ge 1$ there is $x_k$ with $f(x_k) \equiv 0 \pmod{p^k}$ and $x_{k+1} \equiv x_k \pmod{p^k}$; the $x_k$ converge in $\mathbb{Z}_p$ to a root of $f$.

Proof. Suppose $f(x_k) \equiv 0 \pmod{p^k}$ and try $x_{k+1} = x_k + t p^k$. Taylor's formula with integer coefficients gives $f(x_k + tp^k) \equiv f(x_k) + t p^k f'(x_k) \pmod{p^{k+1}}$, because the remaining terms are divisible by $p^{2k}$. Writing $f(x_k) = p^k m$, we need $m + t f'(x_k) \equiv 0 \pmod p$. Since $f'(x_k) \equiv f'(x_1) \not\equiv 0 \pmod p$, this has a unique solution $t \bmod p$. Induction gives the sequence, which is Cauchy for $|\cdot|_p$, and $f$ of its limit is divisible by every power of $p$, hence $0$. $\square$

For $p = 2$ and $f = x^2 + 7$ the derivative $2x$ is always even, so this simple version does not apply; a refined version (lifting from $2^{k+1}$ to $2^{k+2}$, starting from $1^2 \equiv -7 \pmod 8$) still works, and that is what the applet uses.

Further reading

  • N. Koblitz, p-adic Numbers, p-adic Analysis, and Zeta-Functions, 2nd ed., Springer GTM 58, 1984.
  • F. Q. Gouvêa, p-adic Numbers: An Introduction, 3rd ed., Springer Universitext, 2020.
  • J.-P. Serre, A Course in Arithmetic, Springer GTM 7, 1973, Chapter II.