For a prime number and a nonzero integer , the P-adic valuation counts the exponent of in its prime factorization:For , it gives , , and . The sign of a nonzero integer does not change these prime exponents. Relative to an ordered factor base, the valuations supply the coordinates of its exponent vector.
The P-adic valuation extends to nonzero rational numbers by . For example, records a factor in the denominator instead of the numerator. Multiplication adds valuations, ; this is the arithmetic reason why adding exponent vectors can make a product a square. In particular, a positive integer is a square of a number precisely when all its prime exponents are even integers, the criterion used by a factor base.
The p-adic integers retain arithmetic information modulo arbitrarily high powers of one prime number . They form the subringof the P-adic numbers. Their p-adic absolute value bounds the allowed denominators: belongs to , while does not. The name therefore describes a local arithmetic ring, not just the ordinary integers.[ref]
P-adic numbers by Jan-Hendrik Evertse. §3, printed pp. 6–7: definition of Zp, rational denominators and units
A concrete description gives an element by a compatible sequence of congruence classes:The inverse limit condition says that gaining more precision must preserve the digits already determined. Each is a residue modulo ; choosing its least nonnegative integer representative gives . The ordinary integer gives residues modulo .
The useful feature is that one exact object organizes an unlimited family of finite modular arithmetic calculations. Addition and multiplication are performed modulo each , and the results remain compatible. A p-adic digit expansion makes this concrete:The expansion is unique and converges in the p-adic metric; its higher powers have smaller p-adic absolute value. The digit agreement and p-adic distance criterion tells exactly which finite digits a precision bound preserves.[ref]
The p-adic digits are the unique coefficients in for a p-adic integer . Taking least nonnegative representatives of its congruence classes,so each new residue determines one more p-adic digit. For in , the low-to-high digits are , giving . A finite prefix describes a whole coset, not a unique infinite expansion.
Two p-adic integers agree in their first low-order p-adic digits precisely when their difference is divisible by . Equivalently,If the first differing digit has index , the remaining leading coefficient is nonzero modulo , giving exact P-adic valuation and p-adic metric . If no digit differs, the two elements are equal and their distance is zero. Truncating at therefore gives , with a stricter bound possible when further digits are zero.
Let be an integer not divisible by . Its modular inverse modulo has a unique least nonnegative representative . Reducing the inverse equation modulo shows that the representatives are compatible. Since is a p-adic unit,so the sequence converges to the inverse in . This computes a fraction through finite integer operations.
For and , the first eight representatives are . Each satisfies . The resulting expansion isThe geometric series has ratio , whose 2-adic absolute value is , and its sum is . In the ordinary real number absolute value, the representatives grow. Different metrics impose different meanings of a good approximation. The periodic digits here are a specific instance of the rational expansions studied in Conrad's authored note.[ref]
The p-adic integers form a complete metric space and a discrete valuation ring. Every nonzero is uniquely with and a p-adic unit. The prime is a uniformizer, and reduction modulo gives the residue field . The element has no inverse inside , so the ring is not a field.
For a short ideal-classification outline, take a nonzero ideal and choose an element of smallest P-adic valuation , which exists by the well-ordering principle. Its unit factor is invertible, so the ideal contains . Every other element is divisible by , proving that the ideal is . Completeness follows because is a closed subset of the complete metric space . The zero ideal is separate from this nonzero-ideal classification.
The cosets form a neighborhood basis in the additive group of p-adic integers. An open subgroup contains for some , so has finite index. Conversely, if the index is , the finite quotient is annihilated by , giving . Multiplication by the unit part of is bijective, so is open. This proof applies to abstract subgroups without assuming beforehand that they are closed.
A 7-adic integer is an element of the p-adic integers for , equivalently a compatible sequence of residues modulo . Its p-adic digits lie in . For example, has low-to-high digits .
A 2-adic integer is an element of the p-adic integers for , equivalently a compatible sequence of residues modulo . Its binary p-adic digits begin with its parity. The highlighted residue-tree path for begins , while modular inversion converges to a p-adic inverse computes the infinite expansion of .
An element topologically generates the additive group of exactly when , equivalently when is a p-adic unit. In that case its image generates every cyclic quotient .
For a nonnegative integer and a prime number , the Legendre formula computes the prime exponent in a factorial without forming that huge product:Here is the floor function. The sum is finite: every term with is zero. When , all terms vanish, agreeing with and . The prime number hypothesis matters: a composite number does not give the same P-adic valuation or additive prime exponent. For example, the floor sum with is one, whereas divides .
Why count multiples repeatedly? Each multiple of in contributes one factor of ; each multiple of contributes another; and so on. A factor with P-adic valuation occurs in exactly the first counts. Adding those contributions proves the formula.[ref]
Number Theory for Mathematical Contests by David Anthony Santos. David A. Santos, Number Theory for Mathematical Contests, revision 31 October 2007, §8.3, Theorem 245, printed pp. 89–90: factorial valuation and digit form
For the original example ,The five multiples each contribute a second factor of three. The factor contributes a third, so it appears in all three rows. Equivalently, among there are eleven factors of P-adic valuation one, four of valuation two, and one of valuation three: . Thus divides , while does not.
Nested multiples count the factors of three in
. Each colored cell contributes one to the P-adic valuation. Multiples of nine occur in two rows, and occurs in three. Summing by rows gives ; summing by columns gives . Factors not divisible by three contribute zero and are omitted. Details.Repeated Euclidean division provides a practical evaluation: replace by , starting from , and add each new quotient until it is zero. This uses only the successive quotients for the example. The same calculation handles divisibility of binomial coefficients, where the P-adic valuations of the denominator factorials are subtracted.
For a nonnegative integer and integer base , write its base-p expansion asThe base- digit sum is , with . When is a prime number, the Legendre formula becomesTo see the connection, divide the base-p expansion by and discard the fractional part. Swapping the resulting finite sums and using a finite geometric series givesIn particular, , so and . The leading numeral digit contributes thirteen, the next contributes eight, the next one, and the units contribute zero. Thus the base-p digit sum compresses the same contribution ledger into information already present in positional notation.
For nonnegative integers and an integer base ,In column addition, every arithmetic carry replaces units in one numeral digit by one unit in the next position and therefore decreases the base-p digit sum by . Count each outgoing carry separately, including each step of a chain. There is equality precisely when there are no carries. For prime number bases, Kummer's theorem turns this digit-sum deficit into a prime exponent.
For a prime number and integers , the P-adic valuation of the binomial coefficient equals the number of arithmetic carries in the base- addition of and .[ref]
Number Theory for Mathematical Contests by David Anthony Santos. David A. Santos, Number Theory for Mathematical Contests, revision 31 October 2007, §8.3, Theorem 246, printed p. 90: carry count for a binomial coefficient
Indeed, subtract the two denominator factorial valuations in the Legendre formula:Each arithmetic carry accounts for one unit of this quotient by subadditivity of the base-p digit sum. In particular, the binomial coefficient is divisible by exactly when at least one carry occurs.For , the factorial counts giveThe matching base-p expansions are and . Their units add to two; the next column gives , sending one carry into the nines column. That column then gives , and no further carry occurs. The result is . The base-p digit sums check the same result: . Consequently is divisible by three but not by nine.



