Since I’m bored to hell in programming class, my teacher, who is also my physics teacher, gave me the task to find out the trailing zeros of and then for . I then began searching for patterns in factorials starting from to 10!. Interestingly, has one trailing zero and has two trailing zeros. By induction you could determine the trailing zeros of factorials to be expressed by , where is the floor function.

But if you go down the pattern a bit further you find that which has six zeros! The heck? This contradicts our idea. Let’s investigate a bit further.

In a factorial, the amount of fives getting multiplied adds a zero. For example . If we take a look we see that there are two 5s hidden here, and . But contains the factor which is ! So in that case, we find that there are six fives, because .

With this additional information we can determine the number of trailing zeros of  to be

But we are not finished yet, there is a pattern here and we should be able to define it for any .

Given a number , the trailing zeros of is the sum of divided by all of its prime factors of 5.

where has to be chosen such that .

For example let’s calculate the trailing zeros of . We find leaving us with .