We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
There are floor(n/5) + floor(n/25) + floor(n/125)+... zeroes at the end of n! Since 1/5 + 1/25 + 1/125 + ... = 1/4, we would expect (4n!) to be a very good lower bound for our answer. Also, the number of zeroes in successive values of n! only increase when n is a multiple of five. Using those two facts, we can create a starting value that requires very few checks even when n is very large.
Manasa and Factorials
You are viewing a single comment's thread. Return to all comments →
There are floor(n/5) + floor(n/25) + floor(n/125)+... zeroes at the end of n! Since 1/5 + 1/25 + 1/125 + ... = 1/4, we would expect (4n!) to be a very good lower bound for our answer. Also, the number of zeroes in successive values of n! only increase when n is a multiple of five. Using those two facts, we can create a starting value that requires very few checks even when n is very large.