Zeros at the end of a factorial
What´s the best way to calculate how many 0s (zeros) there is at the end of a given factorial?
Sure you could just calculate the whole string of numbers and use your eyes but unfortunately
my calculator only gives x * 10^y answers after a certain point...
I tried to solve that question in the case of 32! and came up with a solution where I split 32! like this:
( (x)nPr(y) = x! / (x-y)!, I think there might be more correct way to write this... but that's how you see it in a calculator, so I guess you´ll understand)
32! = (32)nPr(2) * (30)nPr(5) * (25)nPr(5) * (20)nPr(5) * (15)nPr(5) * 10!
Then I'd calculate each term separately
(32)nPr(2) = 992
(30)nPr(5) / 10 = 1710072
(25)nPr(5) / 100 = 63756
(20)nPr(5) / 10 = 186048
(15)nPr(5) / 10 = 36036
10! / 100 = 36288
Now I can see that 10^7 is a factor in 32! and that the rest are 992, 1710072, 63756, 186048, 36036 and 36288.
So there´s atleast 7 zeros at the end, but then I run into another problem when I try to figure out how many
zeros there might be at the end of 32! / 10^7, which is about 2,631308369 * 10^28. I guess (but am not sure...)
that I can see how many zeros there are by multiplying the last number of each factor: 2*2*6*8*6*8 = 9216. So no
zeros at the end, which would mean that there´s a total of 7 zeros at the end of 32!.
Is there something wrong with my solution and can someone come up with a better one? Thanks in advance.
Btw, I hope I didn´t do too many mistakes in the terms since English is not my native language.