MathLabs
TheoremProved

Legendre's Formula

Statement

For a prime pp and positive integer nn, vp(n!)=∑i=1∞⌊npi⌋v_p(n!) = \sum_{i=1}^{\infty} \left\lfloor \frac{n}{p^i} \right\rfloor.

Why is it true?

Legendre's formula is the standard tool for computing exact prime-power divisibility of factorials and binomial coefficients, and combined with Kummer's theorem it explains exactly which binomial coefficients are divisible by a given prime.

Proof sketch

**Step 1: Write vp(n!)v_p(n!) as a sum over the factors.** By definition n!=1⋅2⋯nn! = 1\cdot 2\cdots n, so vp(n!)=∑k=1nvp(k)v_p(n!) = \sum_{k=1}^{n} v_p(k), the sum of the pp-adic valuation of every integer from 11 to nn.

**Step 2: Rewrite each vp(k)v_p(k) as a count.** For each kk, vp(k)=∑i=1∞[pi∣k]v_p(k) = \sum_{i=1}^{\infty} [p^i \mid k] (using Iverson bracket notation, 11 if true, 00 if false), since kk is divisible by pip^i for exactly vp(k)v_p(k) values of ii (namely i=1,…,vp(k)i=1,\dots,v_p(k)).

Step 3: Swap the order of summation. Substituting, vp(n!)=∑k=1n∑i=1∞[pi∣k]=∑i=1∞∑k=1n[pi∣k]v_p(n!) = \sum_{k=1}^n \sum_{i=1}^{\infty} [p^i \mid k] = \sum_{i=1}^{\infty} \sum_{k=1}^n [p^i \mid k], exchanging the (finite, so justified) double sum.

**Step 4: Count multiples of pip^i directly.** The inner sum ∑k=1n[pi∣k]\sum_{k=1}^n [p^i \mid k] counts how many integers from 11 to nn are multiples of pip^i, which is exactly ⌊npi⌋\left\lfloor \frac{n}{p^i} \right\rfloor (the multiples are pi,2pi,…,⌊n/pi⌋⋅pip^i, 2p^i, \dots, \lfloor n/p^i\rfloor \cdot p^i).

Step 5: Conclude. Substituting back, vp(n!)=∑i=1∞⌊npi⌋v_p(n!) = \sum_{i=1}^{\infty} \left\lfloor \frac{n}{p^i} \right\rfloor, which is finite since ⌊n/pi⌋=0\lfloor n/p^i \rfloor = 0 once pi>np^i > n, completing the proof.

Topics that use this theorem

Step-by-step proofs

No step-by-step proof yet for this theorem.

References

  1. Andrew Granville, Thomas J. Tucker (2002). It's As Easy As abc
  2. Titu Andreescu, Dorin Andrica, Zuming Feng (2007). 104 Number Theory Problems: From the Training of the USA IMO Team
  3. Titu Andreescu, Dorin Andrica, Ion Cucurezeanu (2010). An Introduction to Diophantine Equations: A Problem-Based Approach