In mathematics, Legendre's formula gives an expression for the exponent of the largest power of a prime p that divides the factorial n!. It is named after Adrien-Marie Legendre. It is also sometimes known as de Polignac's formula, after Alphonse de Polignac.
For any prime number p and any positive integer n, let
\nup(n)
\nup(n!)=
infty | |
\sum | |
i=1 |
\left\lfloor
n | |
pi |
\right\rfloor,
\lfloorx\rfloor
pi>n
style\left\lfloor
n | |
pi |
\right\rfloor=0
\nup(n!)=
L | |
\sum | |
i=1 |
\left\lfloor
n | |
pi |
\right\rfloor,
L=\lfloorlogpn\rfloor
For n = 6, one has
6!=720=24 ⋅ 32 ⋅ 51
\nu2(6!)=4,\nu3(6!)=2
\nu5(6!)=1
\begin{align} \nu2(6!)&=
infty | |
\sum | |
i=1 |
\left\lfloor
6 | |
2i |
\right\rfloor=\left\lfloor
6 | |
2 |
\right\rfloor+\left\lfloor
6 | |
4 |
\right\rfloor=3+1=4,\\[3pt] \nu3(6!)&=
infty | |
\sum | |
i=1 |
\left\lfloor
6 | |
3i |
\right\rfloor=\left\lfloor
6 | |
3 |
\right\rfloor=2,\\[3pt] \nu5(6!)&=
infty | |
\sum | |
i=1 |
\left\lfloor
6 | |
5i |
\right\rfloor=\left\lfloor
6 | |
5 |
\right\rfloor=1. \end{align}
Since
n!
n!
\{1,2,...,n\}
style\left\lfloor
n | |
p |
\right\rfloor
p2
p3
\nup(n!)
One may also reformulate Legendre's formula in terms of the base-p expansion of n. Let
sp(n)
\nup(n!)=
n-sp(n) | |
p-1 |
.
s2(6)=1+1+0=2
\nu2(6!)=
6-2 | |
2-1 |
=4.
s3(6)=2+0=2
\nu3(6!)=
6-2 | |
3-1 |
=2.
Write
n=n\ellp\ell+ … +n1p+n0
style\left\lfloor
n | |
pi |
\right\rfloor=n\ellp\ell-i+ … +ni+1p+ni
\begin{align} \nup(n!) &=
\ell | |
\sum | |
i=1 |
\left\lfloor
n | |
pi |
\right\rfloor\\ &=
\ell | |
\sum | |
i=1 |
\left(n\ellp\ell-i+ … +ni+1p+ni\right)\\ &=
\ell | |
\sum | |
i=1 |
\ell | |
\sum | |
j=i |
njpj-i\\ &=
\ell | |
\sum | |
j=1 |
j | |
\sum | |
i=1 |
njpj-i\\ &=
\ell | |
\sum | |
j=1 |
nj ⋅
pj-1 | |
p-1 |
\\ &=
\ell | |
\sum | |
j=0 |
nj ⋅
pj-1 | |
p-1 |
\\ &=
1 | |
p-1 |
\ell | |
\sum | |
j=0 |
\left(njpj-nj\right)\\ &=
1 | |
p-1 |
\left(n-sp(n)\right). \end{align}
Legendre's formula can be used to prove Kummer's theorem. As one special case, it can be used to prove that if n is a positive integer then 4 divides
\binom{2n}{n}
It follows from Legendre's formula that the p-adic exponential function has radius of convergence
p-1/(p-1)