Simple 2-adic integers representation for non-experts, where the examples?

233 Views Asked by At

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:

2

There are 2 best solutions below

10
On

The short answer is in my last comment, a Github resource:

I found an "example generator" at https://siefkenj.github.io/jspadic/ (...)

And, copying the examples generated by the link, the detailed answer is:

  • Yes, the standard "base p" notation is the p-adic notation for small integers of $\mathbb{N}$
  • 0 = (0,0,0,...)2 = $0_2 ~~=? \infty$
  • 1 = (1,0,0,...)2 = $1_2$
  • 2 = (0,1,0,0,...)2 = $01_2$
  • 3 = (1,1,0,0,...)2 = $11_2$
  • ...
  • 13 = (1,1,0,1,0,0,...)2 = $1101_2$
  • ...
  • 12345 = (1,1,0,0,0,0,0,0,1,1,1,0,0,1,0,0,...)2 = $11000000111001_2$
  • ...
  • 123456789 = $\dots 10111100110100010101_2$
  • 1234567891234567 = $\dots 10111010111100000111_2$

You can check the case of 13 by this illustration
 enter image description here

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:

$x = x_0 + x_{1} p + x_{2} p^2 + x_{3} p^3 + \dots + x_{n} p^n$
where p is a prime and the $x_i$ are integers from {0, 1, . . . , p− 1}.

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$

$x = (a_0, a_1, a_2, \dots, a_n)_2$

Starting with the positional notation,

$x = x_0 + x_{1} 2 + x_{2} 4 + x_{3} 8 + \dots + x_{n} 2^n \\ = x_{n} 2^n + x_{n-1}2^{n-1} + x_{n-2}2^{n-2} + \dots + x_0 $

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:

  • 1 = (1,1,1,...)2
  • 2 = (0,2,2,2,...)2
  • 3 = (1,3,3,3,...)2
  • ...
  • 13 = (1,1,5,13,13,...)2
  • ...

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

5
On

Adding the following examples, because in my opinion these are more illuminating about what the $2$-adics are:

  • $-1=\ldots1111$ in the 2-adic notation, or $-1=(1,3,7,15,31,63,127,\ldots)$ in the inverse limit notation. This goes well together with the geometric series sum formula $$a+aq+aq^2+aq^3+\cdots=\frac a{1-q}$$ with $a=1$, $q=2$, and could be read as $$1+2+4+8+16+32+\cdots=\frac1{1-2}=-1.$$ If you ever advance to $2$-adic metrics and convergence in your studies, then all this will make perfect sense.
  • If we look at the inverse limit sequence $x=(1,1,5,5,21,53,53,\ldots)$ we see that $$x^2+7=(8,8,32,32,448,2816,2816,\ldots)=(0,0,0,\ldots),$$ because the entries are all divisible by the prescribed powers of two. It is not immediately obvious that we can continue this sequence, but it is not exceedingly difficult to show that either. Anyway, this 2-adic number can somewhat justifiably claim to be $\sqrt{-7}$.

In some sense you are starting this look into 2-adics at the wrong end by only looking at natural numbers – something you (and your computer) can handle comfortably already. Looking at the negative integers reveals that this is the twos complements notation taken to the infinity. But there are more 2-adics than just the integers, which is what the example with $\sqrt{-7}$ seeks to convey.