Legendre's formula
In mathematics, Legendre's formula gives an expression for the exponent of the largest power of a prime p that divides the factorial . It is named for Adrien-Marie Legendre.
Statement
Let p be a prime and n be a positive integer. Let denote the p-adic valuation of n. Then
where is the floor function. Equivalently, if denotes the sum of the standard base-p digits of n, then
Proof
Since is the product of the integers 1 through n, we obtain at least one factor of p in for each multiple of p in , of which there are . Each multiple of contributes an additional factor of p, each multiple of contributes yet another factor of p, etc. Adding up the number of these factors gives the infinite sum for . The sum contains only finitely many nonzero terms, since for .
To obtain the second form, write in base p. Then , and therefore
Examples
For , we obtain
where is the number of 1s in the binary representation of n.
This can be used to prove that if is a positive integer, then divides if and only if is not a power of .
Applications
Legendre's formula can be used to prove Kummer's theorem.
It follows from Legendre's formula that the p-adic exponential function has radius of convergence .
References
- Legendre, A. M. (1830), Théorie des Nombres, Paris: Firmin Didot Frères
- Moll, Victor H. (2012), Numbers and Functions, American Mathematical Society, ISBN 978-0821887950, MR 2963308, page 77