Home » Placement Preparation » Quantitative Aptitude » Number System » Number System: Factorial and Trailing Zeroes

Number System: Factorial and Trailing Zeroes

Support this post with a reaction:

3,734 views

Practice Questions

Trailing Zeroes in n!

Trailing zeroes come from factors 10 = 2×5. Count powers of 5 in n! (always fewer than powers of 2).

Formula

Trailing zeroes = ⌊n/5⌋ + ⌊n/25⌋ + ⌊n/125⌋ + …

Examples

  • 10! → 10/5 = 2 trailing zeroes
  • 25! → 25/5 + 25/25 = 5 + 1 = 6

Highest power of p in n! (prime p): ⌊n/p⌋ + ⌊n/p²⌋ + …