Factorials • Topic 2 of 3

Highest Power

The highest power of a prime p that divides n! is given by Legendre’s formula: ⌊n/p⌋ + ⌊n/p²⌋ + ⌊n/p³⌋ + …, summing until pᵏ exceeds n. Each floor term counts the multiples of that power of p hiding in 1, 2, …, n. For example, the power of 3 in 100! is ⌊100/3⌋ + ⌊100/9⌋ + ⌊100/27⌋ + ⌊100/81⌋ = 33 + 11 + 3 + 1 = 48, so 3⁴⁸ divides 100! but 3⁴⁹ does not. A fast mental shortcut: divide n by p, take the quotient, divide that quotient by p again, and keep going — the sum of all the quotients is the answer (this avoids recomputing each power from scratch). Trailing zeros are simply this formula applied to p = 5.

✅ Solved examples

1. Find the highest power of 3 that divides 100!.
⌊100/3⌋ + ⌊100/9⌋ + ⌊100/27⌋ + ⌊100/81⌋ = 33 + 11 + 3 + 1 = 48.
2. What is the largest power of 7 dividing 100!?
⌊100/7⌋ + ⌊100/49⌋ = 14 + 2 = 16.
3. Highest power of 2 in 50!?
⌊50/2⌋ + ⌊50/4⌋ + ⌊50/8⌋ + ⌊50/16⌋ + ⌊50/32⌋ = 25 + 12 + 6 + 3 + 1 = 47.
4. Find the exponent of 5 in 1000! (use the running-quotient method).
1000 → 200 → 40 → 8 → 1; sum = 200 + 40 + 8 + 1 = 249.

✏️ Practice — try these, take hints as needed

1. Highest power of 3 in 50!?
⌊50/3⌋ + ⌊50/9⌋ + ⌊50/27⌋.
16 + 5 + 1.
81 > 50, stop.
22
2. Largest power of 2 dividing 20!?
Sum ⌊20/2⌋ … ⌊20/16⌋.
10 + 5 + 2 + 1.
Stop at 16.
18
3. Exponent of 7 in 200!?
⌊200/7⌋ + ⌊200/49⌋.
28 + 4.
343 > 200, stop.
32
4. Highest power of 11 in 100!?
⌊100/11⌋ + ⌊100/121⌋.
9 + 0.
121 > 100.
9
5. Largest power of 5 dividing 250!?
⌊250/5⌋ + ⌊250/25⌋ + ⌊250/125⌋.
50 + 10 + 2.
625 > 250, stop.
62

📝 Topic test — 8 questions

Auto-graded with full solutions; saved to your dashboard. Use the calculator and formula sheet (top-right) any time.

Loading questions…