Puzzle I came up with last night, no calculators allowed:
The final 12 digits of N! (N Factorial) are all zeroes. What is the smallest number N can be?
Generalising this, i.e. finding a formula for the smallest factorial ending in M zeroes, is really quite a pain to do. I’ve not managed it. It would be very easy to write an algorithm for finding solutions, but that’s less fun and not in the non-calculator spirit.
The simpler problem of finding the number of trailing zeroes of any given factorial is made trivial by the formula given in the hints below.
N! must be a multiple of 10^12
Prime factors of 10 are 5 and 2.
Multiples of 2 always outnumber multiples of 5. Therefore, you only need to keep track of multiples of 5.
Remember that some multiples of 5 have more than one 5 in their prime factors.
There’s even a formula! (You shouldn’t need to use this but it’s here)
The solution is N=50