Back to Grade 8

Review: Prime factors in n! (e.g. how many 2s in 45!)

Questions at easy, medium and hard levels. Pick a level and get a fresh set every time, with instant feedback.

Learn it To count how many times a prime p divides n!, add ⌊n ÷ p⌋ + ⌊n ÷ p²⌋ + ⌊n ÷ p³⌋ + … (Legendre's formula). Trailing zeros of n! = the number of 5s.

Example: How many 2s are in 45!?

  1. Multiples of 2: ⌊45 ÷ 2⌋ = 22. Of 4: 11. Of 8: 5. Of 16: 2. Of 32: 1.
  2. Each extra power gives one more 2.
  3. Total: $22 + 11 + 5 + 2 + 1 = 41$.

Loading questions…