Number of zeros in factorial of a number

  • Thread starter Thread starter EighthGrader
  • Start date Start date
  • Tags Tags
    Factorial
AI Thread Summary
The discussion focuses on understanding the formula for calculating the number of trailing zeros in a factorial, which is derived from counting the factors of 5 in the product of integers. The formula involves summing the integer parts of n divided by increasing powers of 5, specifically round(n/5) + round(n/25) + round(n/125), and so on. This method works because each pair of factors 5 and 2 contributes to a trailing zero, and since there are generally more factors of 2 than 5, the count of 5s determines the number of zeros. Examples provided illustrate the application of the formula for 5! and 130!, yielding 1 and 32 zeros, respectively. Understanding this logic is essential for accurately determining the number of trailing zeros in any factorial.
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.
 
Since ##px^9+q## is the factor, then ##x^9=\frac{-q}{p}## will be one of the roots. Let ##f(x)=27x^{18}+bx^9+70##, then: $$27\left(\frac{-q}{p}\right)^2+b\left(\frac{-q}{p}\right)+70=0$$ $$b=27 \frac{q}{p}+70 \frac{p}{q}$$ $$b=\frac{27q^2+70p^2}{pq}$$ From this expression, it looks like there is no greatest value of ##b## because increasing the value of ##p## and ##q## will also increase the value of ##b##. How to find the greatest value of ##b##? Thanks
Back
Top