p-adic algebraic field and base-p digit system for programmers


F. Poyo

Apr. 29, 1996


Introduction

In the following text, we try to intuitively understand p-adic algebraic field (simular concepts to base-p digit system) without decimal point or minus symbol.


Vicinity of "0"

Here we define the distance between a rational number v=ax(p^n)/b (a,b,p are relatively prime) and the origin "0" by


    |v|p=1/(p^n).

Thus, the definition means that a number v is the more divided by p, the nearer from "0". For example,


p=3, v=5    |v|p=|5|3=1/(3^0)       since v=5x(3^0)/1
p=3, v=1/2  |v|p=|1/2|3=1/(3^0)     since v=1x(3^0)/2
p=3, v=9    |v|p=|9|3=1/(3^2)       since v=1x(3^2)/1
p=3, v=5/18 |v|p=|5/18|3=1/(3^(-2)) since v=5x(3^(-2))/2
We call the distance from "0" "the vicinity of 0".


General p-adic number (almost equivalent to a number in base p)

We write a rational v in base p by

     infty    i
  v=  Sum  v p        0 < v  < p-1    k  is an integer
      i=k   i           =  i =
For example, 123.45 in base 10 is written by

              -2       -1       0       1       2       3
 123.45 = 5x10   + 4x10   + 3x10  + 2x10  + 1x10  + 0x10  + ...

where k=-2, all the coefficients v  (i>2) are 0.
                                  i

Number theoretical p-adic number

We can not represent a negative number by the above definition, but in the case that p is a prime number, we can do. For example,

Suppose we represent 0.5 in base p.


   0.5 = a + bx7 + cx(7^2) + dx(7^3) + ...

Since we know 2 is represented by


     2 = 2 + 0x7 + 0x(7^2) + ...,
it follows that

   2x0.5 = 1 = 2xa + 2xbx7 + ...

By using the knowledge that 2xy type integer is one of

2x1=2, 2x2=4, 2x3=6, 2x4=8=1+7, 2x5=10=3+7, 2x6=12=5+7,


we obtain

   a=4.                                         (0)

We can also write the relationship with congruence form by


   1 = 2xa mod 7                                (1)

Formally we rewrite (1) by

   1/2 = a mod 7                                (1')

Thus, (0) is a solution of (1'). Note the left hand side of (1') is 1/2=0.5.

The carry to the position of 10 is given by


   (2xa - 1)/7 = 1      (surplus is trimmed).            (2)

To obtain b, taking the carry 1 from a into account, we write


   0 = 2xb+1 mod 7                              (3)

Formally we rewrite (3) by


   -1/2 = b mod 7,                              (3')

where


   (1/2-a)/7=(1/2-4)/7=-1/2                     (2')

b is given by


   b=3

as a solution of (3'). We can compute the carry to the position of 100 by


  (2xb + 1 - 0)/7=1                               (4)

as well. To obtain c with the carry 1, we would get the solution of


   0 = 2xc + 1 mod 7.                               (5)

However, this is the same equation as (3). Therefore,


   c=3

we can obtain the digits of the other positions repeatedly
by

   d=3, e=3, f=3, ...

Now we have the representation of 0.5 in base 7 under our definition by


   0.5 = 4 + 3x7 + 3x(7^2) + ... + 3x(7^n) + ...

The series looks divergent, but since we have "the vicinity of 0",


       lim   3x(7^n) = 0,
    n->infty

it is not divergent. Therefore we finally obtain the representation of 0.5 in base 7 (7-adic number) by


   0.5= ....333334

Generally we can obtain a p-adic representation of v by the formalization of the above (1'), (2'), (3'), thus

  1. Get a by v = a mod p
  2. Get B by B = (v-a)/p
  3. Get b by B = b mod p
  4. Get C by C = (B-b)/p
    
            ...
    

Yet another examples of 7-adic representation

v=-1 (p=7):
  1. a=6 by -1 = a mod 7
  2. B = (-1-6)/7 = -1
  3. b=6 by -1 = b mod 7
    
          (Since This is the same equation as that in (A),
           we can obtain c=6, d=6, e=6, ... as well.)
    
Therefore, we can represent -1 by 7-adic number

    -1 = ....66666

The calculation 2X0.5 by 7-adic numbers

Recall 0.5=...33334 by 7-adic representation, let us do the multiplication 2X0.5 on paper by the representation.


   ...3334 = 0.5
x)_______2 =   2
        11
        6
       6
    ...
----------
  ...00001 = 1

How far from 0 "-1" is in 7-adic number system?

Recall -1=...6666 in 7-adic representation. The distance between -1 and 0 should be


  0 - (-1) = 1

is it correct in our definition, too? Let us see the confirmation on paper by adding (-1) and 1 as follows. Since


   ...6666 =-1
+)_______1 = 1
   ...0000 = 0,
surely,

    -1 + 1 = 0.


Why prime p must be?

***** An example of 9-adic number system *****

Suppose p=9=3x3, then the 9-adic representation of v=1/3 is calculated by

(A)
In order to solve 1/3 = a mod 9, we write

     1 = 3 x a mod 9.                               (#)
However, since

     3x1=3,        3x2=6,      3x3=0+9,
     3x4=12=3+9,   3x5=15=6+9, 3x6=18=0+2x9,
     3x7=21=3+2x9, 3x8=24=6+2x9,

any a which satisfy (#) does not exist.

***** An example of 6-adic number system *****

Suppose p=6=2x3, then the 6-adic representation of v=0.5 is calculated by

(A)
In order to solve 0.5 = a mod 6

     1 = 2 x a mod 6                       (##)
However, since

  2x1=2,   2x2=4, 2x3=0,
  2x4=2+6, 2x5=4+6

any a which satisfy (##) does not exist.

In the above examples, non-prime number p does not construct satisfiable decimal system, why? This is because when we calculate the multiplication of u in the both side of v=y mod z, thus


      u x v = u x (y mod z),

we can do this only when z and u are relatively prime each other. Assuming z and u have a common divisor a, thus


    z = a x m
    u = a x n,

since y


    u x y=a x n x y

In the both cases y=m x j + k and y=k (k=1,2,...m-1),


    u x y=a x n x (m x j + k)=z x n x j + a x n x k
    u x y=a x n x k          =            a x n x k

we obtain


    u x v = u x y mod z = a x n x k   (in y=m x j + k, k).

Specially, in the case of non-integer v=1/u (u, integer and u != 1),


   u x v = 1 = u x y mod z = a x n x k = u x k  (k=1,2,...,m)

is not satisfied by any k. Therefore z and arbitrary u must be relatively prime. This means that z must be prime number.


p-adic number set in which the number of elements is finite.

Here we define the vicinity of 0 by the different manner from the above sections. The definition is


    |p^N|=0

We do not take the numbers larger than p^N into account. (All the term above p^N is zero.)

Under this definition of the vicinity of 0, suppose p=2, then for example v=1/3 is calculated by

  1. 1/3 = a mod 2
    
         1 = 3xa mod 2
    
        a=1 by 3x1=1+2
    
  2. B = (1/3-1)/2=-1/3
  3. -1/3 = b mod 2
    
         0 = 3xb+1 mod 2
    
         b=1
    
  4. C = (-1/3 - 1)/2 = -2/3
    
        -2/3 = c mod 2
    
         0 = 3xc+2 mod 2
    
         c=0
    
  5. D = (-2/3 - 0)/2 = -1/3
    
         d=1
          This is the same as the result of (B).
    

Therefore, we obtain


   1/3 = ...10101011   (n digits).

In order to confirm this, let n=6 (6bit), then it follows that


    101011   = 1/3
  x)____11   = 3
    101011
   101011
-----------
  10000001 ===> 000001

v=-1 in 2-adic number system (binary) is calculated by

(A) Add 1 to both sides of -1 = a mod 2

      0 = a+1 mod 2
then

      a=1
  1. B=(-1 - 1)/2=-1
  2. Think -1 = b mod 2 in the next, but this is the same equation as (A). Therefore, we obtain
    
         b=1
    
As well as the above, each digit in each position is 1. Thus,

    -1 = 111111    (n digits).
For the confirmation, let n=5, since

      11111  = -1
    +)    1  =  1
-------------------
     100000  =  00000   (since 2^6=0),
it follows that surely (-1)+1=0.

Conclusion

In the case of infinite-number-of-digits system, p-adic number system is constructed by the vicinity of 0

     |v|p=1/(p^n)
where

      v=(a/b)(p^n)

when and only when p is a prime number.

In the case of finite(n)-digits system, we can use the different definition in the vicinity of 0 as


     |p^q|p=0=V(p^q)     ( q > n-1 ).
If we can use "-" or decimal point ".", we can make p-adic system in arbitrary p (, which is not confirmed).