Number of zeros in factorial of a number

  • Thread starter EighthGrader
  • Start date
  • Tags
    Factorial
In summary, the formula for finding the number of zeros in a factorial involves dividing the number by 5, 25, 125, and so on, and summing the results. This is because 5 and 2 make 10, which contributes to one zero in the factorial. However, since there are more 2s than 5s, you need to also divide by higher powers of 5 (25, 125, etc.) to account for all the 5s. The round function is used to only consider the integer part of the division.
  • #1
EighthGrader
11
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
  • #2
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?

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

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.
 
  • #3
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.
 

Related to Number of zeros in factorial of a number

1. How do you calculate the number of zeros in the factorial of a number?

The number of zeros in the factorial of a number can be determined by counting the number of factors of 5 in the prime factorization of the number. For example, the prime factorization of 10 is 2 x 5, and since there is only one factor of 5, the factorial of 10 will have one zero at the end. Similarly, the prime factorization of 20 is 2 x 2 x 5, and there are two factors of 5, so the factorial of 20 will have two zeros at the end.

2. Is there a formula for finding the number of zeros in the factorial of a number?

Yes, there is a formula for finding the number of zeros in the factorial of a number. The formula is n/5 + n/25 + n/125 + ..., where n is the number whose factorial you are calculating and the fractions represent the number of factors of 5, 25, 125, etc. in the prime factorization of n.

3. Why does the number of zeros in the factorial of a number increase as the number gets larger?

The number of zeros in the factorial of a number increases as the number gets larger because there are more factors of 5 in the prime factorization of larger numbers. As the numbers get bigger, the number of factors of 5 also increases, resulting in more zeros at the end of the factorial.

4. Is there a limit to how many zeros can be in the factorial of a number?

Yes, there is a limit to how many zeros can be in the factorial of a number. This limit is determined by the number of digits in the number. For example, a number with 4 digits can have a maximum of 2 zeros at the end of its factorial, while a number with 5 digits can have a maximum of 3 zeros at the end of its factorial. This pattern continues as the number of digits increases.

5. Can the number of zeros in the factorial of a number be negative?

No, the number of zeros in the factorial of a number cannot be negative. The factorial of a number is always a positive integer, so the number of zeros at the end will also be a positive integer.

Back
Top