🇺🇸 AMC 8 ⇄ switch contest
2017 AMC 8

Problem 19

Problem 19 · 2017 AMC 8 Hard
Number Theory factorizationdivisibility

For any positive integer M, the notation M! denotes the product of the integers 1 through M. What is the largest integer n for which 5n is a factor of the sum

98! + 99! + 100! ?
Show answer
Answer: D — 26.
Show hints
Hint 1 of 2
Don't fear the factorials — the smallest, 98!, is a factor of all three (99! = 99·98!, 100! = 100·99·98!). Pull it out and the leftover bracket collapses to something startlingly round.
Still stuck? Show hint 2 →
Hint 2 of 2
Factors of 5 add up from two independent sources: the round leftover, plus the 5's buried inside 98!. For 98!, use Legendre's count: ⌊98/5⌋ + ⌊98/25⌋ (multiples of 5, then the extra 5 in multiples of 25).
Show solution
Approach: factor out 98!, then count 5's from each piece
  1. Factor out the common 98!: 98! + 99! + 100! = 98!(1 + 99 + 100·99) = 98!(100 + 9900) = 98! · 10,000. That clean 10,000 is the payoff for factoring — it's loaded with 5's.
  2. Source 1, the leftover: 10,000 = 104 = 24·54, giving 4 factors of 5.
  3. Source 2, inside 98!: count multiples of 5 (⌊98/5⌋ = 19) plus the second 5 each multiple of 25 contributes (⌊98/25⌋ = 3): that's 19 + 3 = 22 factors of 5.
  4. Add the two sources: 4 + 22 = 26. So the largest such n is 26.
  5. Why this transfers: sums of factorials always factor out the smallest one; and the prime-5 count in any k! is ⌊k/5⌋ + ⌊k/25⌋ + ⌊k/125⌋ + … (Legendre's formula) — the engine behind every "trailing zeros" / "power of a prime in a factorial" question.
Mark: · log in to save