the prime power dividing a factorial


In 1808, Legendre showed that the exact power of a prime p dividing n! is

∑i=1K⌊npi⌋

where K is the largest power of p being ≤n.

Proof.

If p>n then p doesn’t divide n!, and its power is 0, and the sum above is empty. So let the prime p≤n.
For each 1≤i≤K, there are ⌊npi⌋-⌊npi+1⌋ numbers between 1 and n with i being the greatest power of p dividing each. So the power of p dividing n! is

∑i=1Ki⋅(⌊npi⌋-⌊npi+1⌋).

But each ⌊npi⌋,i≥2 in the sum appears with factors i and i-1, so the above sum equals

∑i=1K⁢⌊npi⌋.

∎

Corollary.
∑k=1K⌊npK⌋=n-δp⁢(n)p-1,

where δp denotes the sums of digits function in base p.

Proof.

If n<p, then δp⁢(n)=n and ⌊np⌋ is 0=n-δp⁢(n)p-1. So we assume p≤n.

Let nK⁢nK-1⁢⋯⁢n0 be the p-adic representation of n. Then

n-δp⁢(n)p-1 =∑k=1Knk⁢(∑j=0k-1pj)
=∑0≤j<k≤Kpj.nk
=(n1+n2⁢p+…+nK⁢pK-1)
+(n2+n3⁢p+…+nK⁢pK-2)
⋱
+nK
=∑k=1K⌊npk⌋.

∎

Title the prime power dividing a factorialMathworldPlanetmath
Canonical name ThePrimePowerDividingAFactorial
Date of creation 2013-03-22 13:22:34
Last modified on 2013-03-22 13:22:34
Owner Thomas Heye (1234)
Last modified by Thomas Heye (1234)
Numerical id 10
Author Thomas Heye (1234)
Entry type Theorem
Classification msc 11A51