Loading…
Loading…
Charting your lesson…
Opening your lesson…
Factorials and Trailing Zeros
Lesson 5 of 6
6 steps•about 11 min•12 flashcards
Step 1/ 61 min
"How many zeros are at the end of 100! ?" is a signature placement question. Nobody computes 100! — the answer comes from counting how many times 5 appears in it, using one clean formula.
What this topic tests: counting the power of a prime in a factorial (Legendre's formula) and using it for trailing zeros and highest-power questions.
Step 2/ 61 min
A trailing zero is made by a factor of 10 = 2 × 5. In any factorial there are far more 2s than 5s, so the number of trailing zeros equals the number of 5s in the factorisation of n!.
The exponent of a prime p in n! is
[n/p] + [n/p²] + [n/p³] + … (each term floored, stop when the term is 0).
For zeros in n!, count 5s: [n/5] + [n/25] + [n/125] + …
To find the highest power of, say, 12 = 2²·3 that divides n!, count the 2s and 3s separately, then see how many "12"s you can build.
Step 3/ 61 min
Trailing zeros in 100! Count 5s: [100/5] + [100/25] + [100/125] = 20 + 4 + 0 = 24 zeros.
Highest power of 6 in 30! 6 = 2·3. 3s: [30/3]+[30/9]+[30/27] = 10+3+1 = 14. 2s: [30/2]+[30/4]+…= 15+7+3+1 = 26. Each 6 needs one 2 and one 3 → limited by 3s → 14.
Step 4/ 61 min
TCS NQT advanced quant, Amazon, Microsoft and Goldman Sachs aptitude, and any "number of zeros / highest power of k dividing n!" MCQ.
Step 5/ 61 min
Counting 10s directly, or forgetting the higher terms [n/25], [n/125]. 25 contributes two 5s, 125 contributes three — miss these and your zero count is short.
Step 6/ 6· Worked examples1 min
Problem
How many trailing zeros are there in 100! (100 factorial)?
Try it on paper first.
Recall
Keep this
Usage: count the 5s (not 2s) to get the trailing zeros of a factorial.
"How many zeros at the end of 100!?" is a standard placement question testing the highest-power-of-a-prime idea. Trailing zeros come from factors of 10 = 2 × 5, and since 5s are scarcer than 2s, you just count the 5s.
Highest power of a prime p in n! = ⌊n/p⌋ + ⌊n/p²⌋ + ⌊n/p³⌋ + …
Trailing zeros in n! = ⌊n/5⌋ + ⌊n/25⌋ + ⌊n/125⌋ + … (count of 5s).
Example: zeros in 100! = 20 + 4 = 24. ✓
Highest power of 3 in 50! = 16 + 5 + 1 = 22. ✓
Composite factor: power of a composite = limited by its rarest prime. Power of 6 = 2×3 in 20! = min(power of 2, power of 3) = min(18, 8) = 8.
| Quantity | Rule |
|---|---|
| Trailing zeros in n! | Count of 5s: ⌊n/5⌋+⌊n/25⌋+… |
| Power of prime p in n! | ⌊n/p⌋+⌊n/p²⌋+… |
| Power of composite | min over its primes (using each prime's need) |
Expected exam pattern: trailing zeros of a factorial, highest power of a prime dividing n!, or the largest k with p^k | n!. 1 question, ~45 seconds.
Quick recap: Trailing zeros of n! = count of 5s = ⌊n/5⌋+⌊n/25⌋+…; for any prime use the same running-floor sum; for composites take the binding prime.
You've read 0 of 6 steps
Now lock it in — questions straight after reading are what make it stick.