Paper I · 9 Logical Reasoning & Analytical Ability · 9.1 Number system and simplification

9.1.9 Factorials: trailing zeros and the highest power of a prime in n!

Count how many times a prime goes into n! by repeated division (n/p + n/p² + …), and every question on zeros, powers and divisibility of factorials becomes a short sum.

  • APPSC Paper I · Paper I
  • Standard level
  • 6 min read
  • Free

Free PDF

Download this PDF

Enter your email once and the PDF is yours. We send exam updates and free material; you can stop them any time.

In the print window, choose Save as PDF.

Core facts

  • n! = 1 × 2 × 3 × … × n. 0! = 1 and 1! = 1.
  • Values: 4! = 24, 5! = 120, 6! = 720, 7! = 5,040, 8! = 40,320, 10! = 36,28,800.
  • Highest power of a prime p in n! (Legendre): ⌊n/p⌋ + ⌊n/p²⌋ + ⌊n/p³⌋ + … (stop when pᵏ > n).
    • Short form: divide n by p, then divide the quotient by p again, and add all the quotients.
  • Trailing zeros of n! = highest power of 5 in n! (2s are always more plentiful than 5s in n!).
  • Composite divisor: split it into prime powers, find each limit, and take the smallest.
  • From 5! onwards every factorial ends in 0; from 10! onwards in 00.

Example 1. How many zeros are at the end of 70!? Solution. 70/5 = 14; 14/5 = 2 (whole part). 14 + 2. Answer: 16

Example 2. How many zeros are at the end of 200!? Solution. 200/5 = 40; 40/5 = 8; 8/5 = 1. 40 + 8 + 1. Answer: 49

Example 3. Find 10!/7!. Solution. 10 × 9 × 8. Answer: 720

Explained

Type 1: highest power of a prime.

Example 4. Highest power of 3 that divides 80!. (a) 3²⁶ (b) 3³⁴ (c) 3³⁶ (d) 3⁴⁰ Solution. 80/3 = 26; 26/3 = 8; 8/3 = 2. 26 + 8 + 2 = 36. Answer: (c) 3³⁶

Example 5. Highest power of 7 in 100!. Solution. 100/7 = 14; 14/7 = 2. Answer: 16

Type 2: composite divisor. Count each prime, divide by its exponent in the divisor, take the smallest.

Example 6. Highest power of 12 that divides 30!. Solution. 12 = 2² × 3. Power of 2 in 30!: 15 + 7 + 3 + 1 = 26, giving ⌊26/2⌋ = 13 copies of 2². Power of 3: 10 + 3 + 1 = 14. Smaller is 13. Answer: 13

Example 7. Highest power of 15 in 75!. Solution. 15 = 3 × 5. Power of 5: 15 + 3 = 18. Power of 3: 25 + 8 + 2 = 35. The 5s are scarcer. Answer: 18

Type 3: zeros in a product of factorials. Add the zeros of each factorial (2s are plentiful in each).

Example 8. Zeros at the end of 25! × 30!. Solution. 25!: 5 + 1 = 6. 30!: 6 + 1 = 7. Answer: 13

Type 4: "exactly k zeros". The count jumps at each multiple of 25 (two 5s), 125 (three), and so on.

Example 9. For how many values of n does n! end in exactly 6 zeros? Is there an n! with exactly 5 zeros? Solution. 24! has 4 zeros; 25! has 5 + 1 = 6. The count stays 6 for 25!, 26!, 27!, 28!, 29! and becomes 7 at 30!. It jumps from 4 straight to 6, so no factorial ends in exactly 5 zeros. Answer: 5 values (25 to 29); no

Type 5: remainders and unit digits of factorial sums. Once k! is divisible by the divisor, all later terms drop out.

Example 10. Remainder when 1! + 2! + 3! + … + 100! is divided by 12. Solution. 4! = 24 and every later factorial is divisible by 12. So only 1 + 2 + 6 = 9 is left. Answer: 9

Speed tips.

  • For trailing zeros, divide by 5 repeatedly in your head: 200 → 40 → 8 → 1.
  • For a composite divisor, the largest prime is usually the scarce one, but check: in 30!, 12 = 2² × 3 is limited by 2², not by 3.

Common traps

  • ✗ "Zeros in 200! = 200/5 = 40." ✓ Keep dividing: 40 + 8 + 1 = 49.
  • ✗ "Power of 3 in 80! = 80/3 = 26." ✓ Add 8 and 2 as well: 36.
  • ✗ "Highest power of 12 in 30! = power of 3 = 14." ✓ 2² needs two 2s per copy: ⌊26/2⌋ = 13, which is smaller.
  • ✗ "Every whole number of zeros occurs for some n!." ✓ The count jumps at 25, 50, 75, 125, …; no n! ends in exactly 5 zeros.
  • ✗ "In any product, zeros = number of 5s." ✓ That is true for n!, not for every product; count both 2s and 5s.
  • ✗ "0! = 0." ✓ 0! = 1.

Quick revision

  • Power of prime p in n! = ⌊n/p⌋ + ⌊n/p²⌋ + …
  • Zeros of n! = power of 5 in n!.
  • Composite divisor: limit for each prime power, take the smallest.
  • 0! = 1; 5! = 120; 7! = 5,040; 10! = 36,28,800.
  • 5! onwards ends in 0; 10! onwards ends in 00.
  • 24! has 4 zeros, 25! has 6: no factorial has exactly 5.
  • 250! has 62 zeros (249! has 59): the count jumps by at least 3 at each multiple of 125.
  • Factorial sums: drop every term divisible by the divisor.
  • Products of powers: count 2s and 5s separately.
Go deeper: Deeper (beyond what APPSC Paper I usually asks)

Deeper Advanced

Example 11. Smallest n for which n! ends in at least 60 zeros. (a) 245 (b) 249 (c) 250 (d) 255 Solution. 245! and 249! both have 49 + 9 + 1 = 59 zeros. 250 = 2 × 5³ adds three 5s at once: 250! has 50 + 10 + 2 = 62. Answer: (c) 250

Example 12. Zeros at the end of 5⁵ × 10¹⁰ × 15¹⁵ × … × 50⁵⁰. Solution. Here the 2s, not the 5s, are scarce, so count both.

  • 5s: each term (5k)^(5k) gives 5k for every 5 in 5k. Sum of 5k for k = 1 to 10 is 275; 25 (k = 5) and 50 (k = 10) give an extra 25 + 50. Total 5s = 350.
  • 2s: only even 5k give 2s: 10¹⁰ (10), 20²⁰ (40), 30³⁰ (30), 40⁴⁰ (120), 50⁵⁰ (50). Total 2s = 250.

Answer: 250

Example 13. Last two digits of 1! + 2! + … + 10!. Solution. 10! ends in 00. 1 + 2 + 6 + 24 + 120 + 720 + 5,040 + 40,320 + 3,62,880 = 4,09,113. Answer: 13

Example 14. Highest power of 2 in 60!, and the number of zeros at the end of 120!/60!. Solution. Power of 2 in 60!: 30 + 15 + 7 + 3 + 1 = 56. 120! has 24 + 4 = 28 zeros and 60! has 12 + 2 = 14, and 120!/60! still has more 2s than 5s (116 − 56 = 60), so it ends in 28 − 14 = 14 zeros. Answer: 56; 14

  • A check by expansion: 25! = 15,511,210,043,330,985,984,000,000 (26 digits, 6 trailing zeros), a quick check for Legendre counts.
  • Factorials in base other than 10: zeros of n! in base b = highest power of b in n! (same composite-divisor method).

Sources: Standard results of elementary number theory (Legendre's formula for the exponent of a prime in n!); NCERT Mathematics textbook, Class 11 (permutations: factorial notation)

Last checked 2026-10-17.

Practise this topic. Questions on Numerical ability, with answers explained.

Medha AI writes its own notes and checks them against the sources listed. Medha AI is an independent preparation service. It is not affiliated with, endorsed by or connected to APPSC, TSPSC, MPSC, UPSC or any other commission or government body.