Math 2325
Project 6 (Chapter 8) - p-adic Numbers

Helmut Knaust, Department of Mathematical Sciences, UTEP, El Paso TX 79968
hknaust@utep.edu
11/10/2012. Last edits 11/21/2012

Factoring Integers

The following command displays the prime factorization of an integer.

PrimeFactorization[nr_]:=Module[{fd},fd=FactorInteger[nr];Print[nr," = ",If [Length[fd]>1,CenterDot@@(Superscript@@@fd),(Superscript@@fd[[1]])] ]]

PrimeFactorization[99999]

The command also works for rational numbers:

PrimeFactorization[1000/555]

Computing p-adic Norms

The next command computes the p - adic norm of a rational number x.

PadicNorm[x_,p_:5]:=Module[{a=Cases[FactorInteger[x],{p,_}]},
If[a==={},If[x==0,0,1],First[1/Power@@@a]]]

PadicNorm[1/15,3]

PadicNorm[18,3]

PadicNorm[21/20,3]

PadicNorm[2,7]

The default for p is 5.

PadicNorm[21/20]

The last command is adapted from http://mathworld.wolfram.com/notebooks/Algebra/p-adicNorm.nb by Eric W. Weisstein.

Checking Divisibility

The command below checks for which integer values of x, the expression  3x-2 is divisible by 5. (You can change the “3x-2” and the “5”).

Solve[3x-2==0,Modulus->5][[1]]