Number of zeros in factorial of a number

  • Thread starter Thread starter EighthGrader
  • Start date Start date
  • Tags Tags
    Factorial
Click For Summary
SUMMARY

The discussion focuses on the formula for calculating the number of trailing zeros in the factorial of a number, specifically using the formula: round(n/5) + round(n/25) + round(n/125) + ... + round(n/5^k), where k is the largest integer such that 5^k ≤ n. For example, to find the number of zeros in 130!, the calculation yields 32 zeros. The logic behind this formula is that each pair of factors 5 and 2 contributes to a trailing zero, and since there are always more factors of 2 than 5 in factorials, counting the factors of 5 suffices.

PREREQUISITES
  • Understanding of factorials and their properties
  • Basic knowledge of integer division and rounding functions
  • Familiarity with exponential notation (e.g., 5^n)
  • Concept of prime factorization in mathematics
NEXT STEPS
  • Study the mathematical properties of factorials and their growth rates
  • Learn about the application of the floor function in combinatorial mathematics
  • Explore the concept of prime factorization and its relevance in number theory
  • Investigate other combinatorial problems involving trailing zeros, such as in binomial coefficients
USEFUL FOR

Mathematicians, educators, students studying combinatorics, and anyone interested in understanding the properties of factorials and their applications in number theory.

EighthGrader
Messages
11
Reaction score
0

Homework Statement



This is not a homework problem. I was just wondering the logic and intuition behind the "formula" for finding the number of zeros given the factorial of a number.

Homework Equations



Formula : round(n/5) + round(n/25) + round(n/125)+...+round(n/5^n)
Here, round function indicates that only the integer part of (n/5^n) should be taken.


Example1 : Say if you want to find the number of zero's in 5! ??

Usage : In this case n = 5.

-> round(5/5) + round(5/25)+...

->round(1) + round(0)

-> 1 (1 zero in 5!)


Example2 : find the number of zero's in 130! ??

Usage : In this case n = 130.

-> round(130/5) + round(130/25) + round(130/125) ...

->round(26) + round(5) + round(1)

-> 32 (32 zeroes in 130!)


Thanks!
 
Physics news on Phys.org
That round function looks like the "nearest integer function" [x], which returns the nearest integer less than or equal to x.

So your function looks like this?

\sum_{n=1}^\infty \left[\frac{x}{5^n}\right]

I would assume it has to do with the fact that the factorial, being the product of integers, requires a factor of 10=5*2 for one zero, a factor of 100=10*5*2 for two zeros, etc.
 
It's because 5 and 2 make 10, which has one 0. There will be more 2s than 5s, so you only need to find how many 5s there are to match up with the 2s.

Now let's look at the formula itself. Normally to find how many fives there are, you divide by 5. Say 26/5 = 5 fives.

However, 25 in itself has 2 5's (5*5), so if you don't divide by 25, you will miss the other 5. Same goes when x > 125, x > 625, etc. 125 = 5^3, and 625 = 5^4, so you need to divide by those numbers in order to take all 5s into account.

Ask more questions if my explanation isn't clear enough.
 

Similar threads

  • · Replies 29 ·
Replies
29
Views
6K
Replies
5
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 34 ·
2
Replies
34
Views
6K
Replies
21
Views
15K
  • · Replies 3 ·
Replies
3
Views
2K
Replies
13
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 40 ·
2
Replies
40
Views
6K