{
  "aliases": [
    "de-polignac-formula"
  ],
  "backlinks": null,
  "body": "\n## Statement\n\nLet $p$ be a prime number and let $n$ be a natural number. Let $\\nu_p$ be the [[p-adic valuation|04VCPS30ZE]].\nThen\n$$\\nu_p(n!) = \\sum_{i=1}^{\\infty} \\left\\lfloor \\frac{n}{p^i} \\right\\rfloor.$$\nThe sum is finite, because $\\lfloor n / p^i \\rfloor = 0$ when $p^i \u003e n$.\n\n## Remarks\n\nAn equivalent form: $\\nu_p(n!) = \\dfrac{n - s_p(n)}{p - 1}$, where $s_p(n)$ is the sum of the digits of $n$ in base $p$.\nFor example, $\\nu_2(10!) = 5 + 2 + 1 = 8$, and $\\nu_5(100!) = 20 + 4 = 24$. So $100!$ ends with $24$ zeros.\nThe proof counts, for each $i$, the multiples of $p^i$ among $1, \\dots, n$.\n\n## Explanations\n\n### L1 human\n\nTo count the factors $p$ in $n!$, count the multiples of $p$ up to $n$. Then add the multiples of $p^2$, which give a second factor, and so on.\nFor $10!$ and $p = 3$: there are $3$ multiples of $3$ and $1$ multiple of $9$, so $3^4$ is the largest power of $3$ that divides $10!$.\n",
  "commit": "f591989ed15704e9d8755a7a5a6426d73de7a3ae",
  "front": {
    "aliases": [
      "de-polignac-formula"
    ],
    "kind": "statement",
    "msc": [
      "11A51"
    ],
    "name": "Legendre's formula",
    "role": "theorem",
    "same_as": {
      "wikidata": "Q23041626",
      "wikipedia": "Legendre's formula"
    },
    "sources": [
      {
        "locator": "Statement",
        "url": "https://en.wikipedia.org/wiki/Legendre%27s_formula"
      }
    ],
    "tag": "01WPV9PHN7",
    "uses": [
      "04VCPS30ZE"
    ]
  },
  "kind": "statement",
  "link": "https://math2.tamnd.com/node/01WPV9PHN7/",
  "links": [
    {
      "field": "uses",
      "target": "04VCPS30ZE"
    }
  ],
  "markdown": "https://math2.tamnd.com/node/01WPV9PHN7.md",
  "msc": [
    "11A51"
  ],
  "name": "Legendre's formula",
  "prov": null,
  "role": "theorem",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/01W/01WPV9PHN7.md",
  "status": null,
  "tag": "01WPV9PHN7",
  "uri": "m2://01WPV9PHN7",
  "url": "https://math2.tamnd.com/wiki/legendres-formula/",
  "writing": {
    "tag": "01WPV9PHN7",
    "kind": "statement",
    "level": "W0",
    "next": [
      {
        "what": "an inventory row",
        "note": "the row of the inventory that the node accounts for",
        "have": 0,
        "want": 1
      }
    ]
  }
}
