Earlier today I posted the following video, in which I asked Google Assistant to calculate the factorial of 100.
The factorial of 100 is the multiplication 100 x 99 x 98 x … x 3 x 2 x 1 in which 100 is multiplied by every whole number below it.
The answer is 158-digits long. Google Assistant’s valiant effort, however, does not get every digit correct.
Today’s puzzle was:
How many zeros does the factorial of 100 really have at the end of it?
[I will use the mathematical symbol ‘!’ for factorial below. Thus the factorial of 100 is also written 100!.]
I mentioned in the original post that if a number has a zero at the end of it, it is divisible by 10. What we need to do here is work out how many times 10 divides into the number 100 x 99 x 98 x … x 3 x 2 x 1.
Let’s start: 10 divides once each into 10, 20, 30, 40, 50, 60, 70, 80, 90 and twice into 100, which means there must be at least 11 zeros at the end of 100!.
Yet it is possible to multiply two numbers that don’t end in 0 to create one that does. For example, 8 x 5 = 40. How do we account for all the times that numbers in the breakdown of 100! multiply together to make a number divisible by 10?
The clue is to realise that 10 = 2 x 5. And that every time two numbers multiply together to create a number that is divisible by 10, there must be a 2 and a 5 involved.
E.g. 8 x 5 = 2 x 2 x 2 x 5 = (2 x 2) x (2 x 5) = 4 x 10 = 40.
So, we can rephrase our task as having to look for all the instances of (2 x 5) in 100!. In other words, we need to break down every number from 1 to 100 into its factors and see how many times 5 and 2 appear.
How many times does 5 appear as a factor in the numbers from 1 to 100? Well, counting upwards in 5s, we get 5, 10, 15, 20…90, 95, 100. These 20 numbers have five as a factor. In fact 25, 50, 75 and 100 have 5 as a factor twice. So the number of times that 5 appears as a factor is 24.
We can quickly see that 2 appears as a factor at least 24 times (just count the even numbers), so the total number of times (2 x 5) appears in 100! must be 24. The number of zeros at the end of 100! is 24.
For those who are interested, 100! in all its glory is:
I set a puzzle here every two weeks on a Monday. I’m always on the look-out for great puzzles. If you would like to suggest one, email me.
I’m the author of several books of puzzles, most recently the Language Lover’s Puzzle Book. I also give school talks about maths and puzzles (online and in person). If your school is interested please get in touch.