Quote:
Originally Posted by karthick_prabu Ya i completely agree with you that we need to find the number of 5's in the given factorial number.
but, how did the formula --> round(n/5)+round(n/25)+.... arrive?
btwn, thanks for the info smilingtears.  |
simple chhe..
I'll tell you with an example..
If you want to know how many fives are there in 26!
By convention,you'll go about finding how many fives you have..so you'll divide by 5 n u'll get 5 as the answer..but in reality it has 6 fives.. one from 25 which is equal to 5*5..
Dividing by 5 once will give you the multiples of 5..So,you'll have to divide by 5 again to count for this extra five..
better way to do it is..
find n/5.Now,see if Quotient is greater than 5,if it is..divide it again by 5 n continue till you get a quotient less than 5. It's better than dividing by 25,125(5*5*5) n so on..
Example for 26! as taken above:
no of 5s= 26/5=5(q)+1(r)
discard r=1 n divide 5 by 5 again..you'll get 1..
so answer is 5+1=6
You can use it to find no. of any digit in a factorial
say you want to find number of 2s in 43!
no. of 2s= 43/2=20(q)
since 20> 2 therefore divide again by 2..
so u'll have the series like
20+10+5+2+1
38 twos
