There are some p-adic integers definitions, all vague (for non-mathematicians), as this Wikipedia's definition:
$x = (x_1 \operatorname{mod} p, ~ x_2 \operatorname{mod} p^2, ~ x_3 \operatorname{mod} p^3, ~ \ldots)$
How to calculate $x_i$? Can I use the the standard positional notation?
I need some basic examples with the answer, using small integers.
Let p=2 and $x \in \mathbb{N}$, starting with small x:
- 0 = (0,0,0,0,...)2 ? $~~=? \infty$
- 1 = (1,0,0,0,...)2 ?
- 2 = (0,1,0,0,...)2 ?
- ... ? ...
... Or, better, a Python/Javascript/Any script that generates correct examples.
Note
There is not yet an "ISO standard" for expressing p-adics, sometimes it is confusing.
This question is not a duplicate:
- No list of simple examples at Binary representation of 2-adic integers
- No list of simple examples at Representation of p-adic integers
The short answer is in my last comment, a Github resource:
And, copying the examples generated by the link, the detailed answer is:
You can check the case of 13 by this illustration

PS: inductive reasoning is very important for non-mathematicians, to confirm that the interpretation of mathematician notation is correct.
Abstract mathematical notation is very abstract for normal humans, and sometimes ambiguous and confusing. The concrete examples are didactic, eliminating doubts and ambiguities.
How to build same $x_i$ from mod operator
The didactic challenge is to start from the classic positional notation and express an algorithm to build the same digits (all digits d with values d<p).
The positional notation (for natural numbers) say that:
So, for $p=2$ we have:
$x = x_0 + 2x_{1} + 4x_{2} + 8x_{3} + \dots + 2^{n}x_{n} $
where the $x_i$ are integers from {0, 1}.
A non-expert reader see that $x_0 = x \operatorname{mod} p$, but is not so easy to see how to build the $x_i$ factors of the next powers, $2^i$, using the $\operatorname{mod}$ operator.
So the 2-adic number, when $x \in \mathbb{N}$, at this step, is something as:
$(x_0, x_1, x_2, x_3, \dots, x_n) = (\dots, x_{n-3}, x_{n-2}, x_{n-1}, x_n)$
Using the results of the "inverse limit notation" (section below),
$x_n = x\operatorname{mod}2 \\ x_{n-1}=(x\operatorname{mod}4 - x\operatorname{mod}2)/2 \\ x_{n-2} = (x\operatorname{mod}8 - x\operatorname{mod}4)/4 \\ x_{n-3} = (x\operatorname{mod}16 - x\operatorname{mod}8)/8 \\ \dots$
Checking with 13: $((13\operatorname{mod}16 - 13\operatorname{mod}8)/8, (13\operatorname{mod}8 - 13\operatorname{mod}4)/4, (13\operatorname{mod}4 - 13\operatorname{mod}2)/2, 13\operatorname{mod}2) ~=~ (~(13 - 5)/8, ~(5 - 1)/4, ~(1 - 1 )/2, ~1) ~=~ (8/8, 4/4, 0, 1) = (1, 1, 0, 1)$
PS: using here the [Caruso2017,page 4]'s definition of p-adic number, with classic positional notation. It is also used by Siefkenj at examples generator.
To avoid "notation conflicts" we need to show another mathematician notation, that is not the positional notation.
How to build the inverse limit notation from positional
A 2-adic number, even the simplest (small numbers of $\mathbb{N}$), can be expressed by other notation, of expansion factors $a_i$ that are outside the previous constraint $x_i<2$, we can use any $0 \leq a_i$
Starting with the positional notation,
To express the number by mod operator:
$x = (x \operatorname{mod} 2, ~x \operatorname{mod} 4, ~x \operatorname{mod} 8, \dots)\\ = (x_{n},~~ x_{n} + 2x_{n-1},~~ x_{n} + 2x_{n-1} + 4x_{n-2},~~ \dots)_2$
Now we obtain different results in the concrete examples:
Check, with 13, the use of positional notation factors: $x_0=1; ~x_1=1; ~x_2=0; ~x_3=1$.
Using them we have:
$a_0=x_3=1;\\a_1= x_3 + 2x_{2}=1+0=1;\\ a_2=x_3 + 2x_2 + 4x_1=1+0+4=5;\\ a_3=x_3 + 2x_2 + 4x_1 + 8x_0=1+0+4+8=13.$
So, by these results we have 13 = (1,1,5,13,...)2.
References
Using as main reference a open access document that seems a good "p-adic for Data Science" reference, [Caruso2017] https://hal.science/hal-01444183/document
Other didactic references, remembered by @DaveLRenfro, at
https://math.stackexchange.com/a/2861364/70274