In number theory, given a prime number p, the p-adic numbers form an extension of the rational numbers that is distinct from the real numbers, though with some similar properties; p-adic numbers can be written in a form similar to (possibly infinite) decimals, but with digits based on a prime number p rather than ten, and extending to the left rather than to the right.
For example, comparing the expansion of the rational number
in base 3 vs. the 3-adic expansion,![{\displaystyle {\begin{alignedat}{3}{\tfrac {1}{5}}&{}=0.01210121\ldots \ ({\text{base }}3)&&{}=0\cdot 3^{0}+0\cdot 3^{-1}+1\cdot 3^{-2}+2\cdot 3^{-3}+\cdots \\[5mu]{\tfrac {1}{5}}&{}=\dots 121012102\ \ ({\text{3-adic}})&&{}=\cdots +2\cdot 3^{3}+1\cdot 3^{2}+0\cdot 3^{1}+2\cdot 3^{0}.\end{alignedat}}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/a91337f3d3043e9236041f8f7e6bec74389665dd)