Math 2.0

Number theory Proof

Proof of Legendre's formula by counting multiples of prime powers

Builds on P-adic valuationP-adic valuation of a productFactorialFloor functionPrime number

Proof

  1. Let pp be a prime number and nn a natural number. If n=0n = 0, then 0!=10! = 1 by the definition of the factorial. So νp(0!)=0\nu_p(0!) = 0, and every term ⌊0/pi⌋\lfloor 0 / p^i \rfloor is 00. Assume now n≥1n \ge 1.
  2. We have n!=1⋅2⋯nn! = 1 \cdot 2 \cdots n. Applying the valuation of a product n−1n - 1 times gives νp(n!)=∑k=1nνp(k)\nu_p(n!) = \sum_{k=1}^{n} \nu_p(k).
  3. Let 1≤k≤n1 \le k \le n and i≥1i \ge 1. By the definition of the p-adic valuation, pi∣kp^i \mid k holds if and only if i≤νp(k)i \le \nu_p(k). Indeed, if i≤νp(k)i \le \nu_p(k) then pi∣pνp(k)∣kp^i \mid p^{\nu_p(k)} \mid k, and if i>νp(k)i > \nu_p(k) then pi∤kp^i \nmid k by maximality.
  4. So νp(k)\nu_p(k) is the number of integers i≥1i \ge 1 with pi∣kp^i \mid k.
  5. Substituting step 4 into step 2 and counting the pairs (k,i)(k, i) the other way gives νp(n!)=∑i≥1Ni\nu_p(n!) = \sum_{i \ge 1} N_i. Here NiN_i is the number of kk with 1≤k≤n1 \le k \le n and pi∣kp^i \mid k.
  6. Only finitely many NiN_i are nonzero, because pi>np^i > n implies Ni=0N_i = 0.
  7. Fix i≥1i \ge 1 and let d=pid = p^i. The multiples of dd in {1,…,n}\set{1, \dots, n} are the numbers jdjd with jj an integer and 1≤j≤n/d1 \le j \le n/d.
  8. An integer jj satisfies j≤n/dj \le n/d if and only if j≤⌊n/d⌋j \le \lfloor n/d \rfloor, by the definition of the floor function. So Ni=⌊n/pi⌋N_i = \lfloor n / p^i \rfloor.
  9. Hence νp(n!)=∑i=1∞⌊n/pi⌋\nu_p(n!) = \sum_{i=1}^{\infty} \lfloor n / p^i \rfloor, where only finitely many terms are nonzero.

Idea

Each k≤nk \le n contributes νp(k)\nu_p(k) factors of pp to n!n!. Count these factors by layers: every multiple of pp gives one, every multiple of p2p^2 gives one more, and so on. The number of multiples of pip^i up to nn is ⌊n/pi⌋\lfloor n/p^i \rfloor.

Reading path

To understand this page from the ground up, read these 69 pages in order. The foundations come first. The path takes the proofs Proof of Bézout's identity, Proof of the approximation property of the supremum, Proof of the generalized Euclid's lemma, Proof of the commutativity of addition by induction, Proof of Euclid's lemma, Proof that the reals form an ordered field, with the Cauchy sequence construction, Proof of strong induction from ordinary induction, Proof that the p-adic valuation of a product is the sum of the valuations, Proof of the well-ordering principle from strong induction, Proof of the division algorithm, Proof that the reals are Archimedean from the completeness axiom.

  1. Construction of the reals from Cauchy sequences concept
  2. Definition by recursion concept
  3. Divisibility definition
  4. Element definition
  5. Factorial definition
  6. Integers object
  7. Mathematical induction concept
  8. Natural numbers object
  9. Ordered field definition
  10. Peano axioms concept
  11. Proposition concept
  12. Rational numbers object
  13. Real numbers object
  14. Set bounded above definition
  15. Greatest common divisor definition
  16. Prime number definition
  17. Set definition
  18. Ring of integers statement
  19. Archimedean ordered field definition
  20. Successor function definition
  21. Implication definition
  22. Predicate definition
  23. The reals form a field statement
  24. Supremum definition
  25. Coprime integers definition
  26. P-adic valuation definition
  27. Ordered pair definition
  28. Addition of natural numbers definition
  29. The rationals form a field statement
  30. The successor function is injective statement
  31. Universal quantifier definition
  32. Zero is not a successor statement
  33. Completeness axiom statement
  34. Cartesian product definition
  35. Subset definition
  36. Proof of the commutativity of addition by induction proof
  37. Order on the natural numbers definition
  38. The rationals form an ordered field statement
  39. Binary relation definition
  40. Order on the reals definition
  41. Commutativity of addition statement
  42. Proof of strong induction from ordinary induction proof
  43. Antisymmetric relation definition
  44. Reflexive relation definition
  45. Transitive relation definition
  46. Strong induction statement
  47. Preorder definition
  48. Proof of the well-ordering principle from strong induction proof
  49. Partial order definition
  50. Well-ordering principle statement
  51. Total order definition
  52. Proof of the division algorithm proof
  53. Division algorithm statement
  54. Proof that the reals form an ordered field, with the Cauchy sequence construction proof
  55. Proof of Bézout's identity proof
  56. The reals form an ordered field statement
  57. Bézout's identity statement
  58. Proof of the approximation property of the supremum proof
  59. Proof of the generalized Euclid's lemma proof
  60. Approximation property of the supremum statement
  61. Generalized Euclid's lemma statement
  62. Proof that the reals are Archimedean from the completeness axiom proof
  63. Proof of Euclid's lemma proof
  64. The reals are Archimedean statement
  65. Euclid's lemma statement
  66. Floor function definition
  67. Proof that the p-adic valuation of a product is the sum of the valuations proof
  68. P-adic valuation of a product statement
  69. Proof of Legendre's formula by counting multiples of prime powers proof

Where this leads

3 pages build on this one.

Further reading

  1. Web https://en.wikipedia.org/wiki/Legendre%27s_formula, Proof
About this page
TagWFYM20H4MK
URIm2://WFYM20H4MK
Kindproof
WritingW0 stub
MSC11A51
ProvesLegendre's formula
UsesP-adic valuation, P-adic valuation of a product, Factorial, Floor function, Prime number
Changed4 November 2026

Markdown · JSON · Edit on GitHub

What this page needs for W1

  • an inventory row: the row of the inventory that the node accounts for (0 of 1)

The writing levels say how complete the text of a page is. They do not measure its truth.

What links here

No page links to this page yet.