You're probably reading this page because you've been assigned a seemingly impossible exercise, something along the lines of "Here's a really big number; consider its much (much!) bigger factorial and then figure out how many zeroes are at the end of the multiplied-out factorial."

Content Continues Below

This "trailing zeroes in a factorial" exercise is pretty easy to answer once you think about it the right way. I couldn't find anything much useful on the Internet, so here's a little lesson on how to handle it.

If we take the factorial of any number larger than 5, then there will be at least one zero at the end of the number. Why? Because 5! = 1×2×3×4×5; in particular, 5! = (2×5)×(1×3×4), and (2×5) = 10. The factorial of any larger number will have more copies of 2 and 5 (as factors of larger values, like 6 and 15), so there will be even more factors of 10 in these factorials. And every factor of 10 adds a zero to the end of the factorial expansion.

Not every factorial has at least one zero at the end of it. However, as soon as you get to 5!, which contains a factor of 2 and a factor of 5, you'll get a trailing zero. Larger factorials will have more zeroes. So the only factorials which do *not* have any trailing zeroes are 0!, 1!, 2!, and 4!.

This explains why there are trailing zeroes — because the factorials contain factors of 10 in them — but this doesn't tell us how to find the actual number of trailing zeroes. However, since the zeroes come from factors of 10, we can methodically figure out the actual number.

In the example below, I'll go through the reasoning which will then create a method for quickly answering this question.

- Find the number of trailing zeroes in the expansion of 23!

If I plug this into my calculator, it'll give me a result formatted in scientific notation, because the answer is too big for the calculator to display in its entirety. In practical terms, the calculator will show me the beginning of the number; unfortunately, I'm only caring about the end of the number (namely, the "trailing zeroes" part). So the calculator won't help. I'll try expanding the factorial:

(By the way, yes, "zeroes" is a proper plural of "zero".)

1×2×3×4×5×6×7×8×9

×10×11×12×13×14×15×16

×17×18×19×20×21×22×23

Affiliate

I know that a number gets a zero at the end of it if the number has 10 as a factor. For instance, 10 is a factor of 50, 120, and 1234567890; but 10 is only once a factor of each of these numbers, which is why each number has only one trailing zero. So I need to find out how many times 10 is a factor in the expansion of 23!.

Advertisement

I note that 5×2 = 10, so I need to account for all the products of 5 and 2 that exist in a given factorial's expansion. Looking at the factors in the above expansion, there are many more numbers that are multiples of 2 (namely, 2, 4, 6, 8, 10, 12, 14, …) than are multiples of 5 (namely, 5, 10, 15, …).

No matter how many times that 5 is a factor of a given expansion, I know that 2 will be a factor many times more often. If I take all the numbers in the expansion that have 5 as a factor, I'll have way more than enough even numbers to pair with the factor-5 numbers to get factors of 10 — and another trailing zero on my factorial.

So to find the number of times 10 is a factor, all I really need to worry about is how many times 5 is a factor in all of the numbers between 1 and 23. I can ignore the factors of 2. This is a very helpful simplification.

So, looking at this exercise, how many multiples of 5 are between 1 and 23? There is 5, 10, 15, and 20, for four multiples of 5. Paired with 2's from the even factors, this makes for four factors of 10, so:

23! has four trailing zeroes

In fact, if I were to go to the trouble of multiplying out this factorial, I would be able to confirm that 23! = 25,852,016,738,884,976,640,000 does indeed have four trailing zeroes. I would also confirm that I really don't want to have to multiply things out; a logical method is going to be much better (that is, it is going to be much easier) than applying brute force.

Content Continues Below

- Find the number of trailing zeroes in 101!

Okay, I'll start by finding out how many multiples of 5 are to be found within the numbers (that is, the whole-number factors) from 1 to 101? There's 5, 10, 15, 20, 25,...

Oh, heck; let's do this the short way: 100 is the closest multiple of 5 below 101, and 100 ÷ 5 = 20, so there are twenty multiples of 5 between 1 and 101.

But wait: 25 is equal to 5 × 5, so each multiple of 25 has an extra factor of 5 that I need to account for. How many multiples of 25 are between 1 and 101? Since 100 ÷ 25 = 4, there are four multiples of 25 between 1 and 101. These will give me four more copies of 10, and thus four more trailing zeroes at the end of the factorial.

Adding these, I get 20 + 4 =

24 trailing zeroes in 101!

This reasoning, of finding the number of multiples of 5^{1} = 5, plus the number of multiples of 5^{2} = 25, etc, extends to working with even larger factorials.

Affiliate

- Find the number of trailing zeroes in the expansion of 1000!

Okay, there are 1000 ÷ 5 = 200 multiples of 5 between 1 and 1000.

The next power of 5, namely 5^{2} = 25, has 1000 ÷ 25 = 40 multiples between 1 and 1000.

The next power of 5, namely 5^{3} = 125, will also occur in the expansion, since 125 < 1000. Doing the division, I find that there are 1000 ÷ 125 = 8 multiples of 125 between 1 and 1000.

The next power of 5, namely 5^{4} = 625, also fits in the expansion, and occurs 1000 ÷ 625 = 1.6 times. Um, okay; decimal or fractional portions of a multiple don't make much sense in context, so I'll truncate; 625 occurs 1 time between 1 and 1000. I care only about the one full multiple of 625; I don't care about the 0.6 of a multiple, so I can safely ignore this.

In total, I have 200 + 40 + 8 + 1 = 249 copies of the factor 5 in the expansion, and thus:

1000! has 249 trailing zeroes

The example above highlights the general method for answering this question, no matter what factorial they give you.

- Take the number that you've been given the factorial of.
- Divide by 5; if you get a decimal, truncate to a whole number.
- Divide by 5
^{2}= 25; if you get a decimal, truncate to a whole number. - Divide by 5
^{3}= 125; if you get a decimal, truncate to a whole number. - Continue with ever-higher powers of 5, until your division results in a number less than 1. Once the division is less than 1, stop.
- Sum all the whole numbers that you got in your divisions. This is the number of trailing zeroes.

What do these steps look like, in application?

- How many trailing zeroes would be found in 4617!, upon expansion?

I'll apply the procedure from above:

- 5
^{1}: 4617 ÷ 5 = 923.4, so I get 923 factors of 5 - 5
^{2}: 4617 ÷ 25 = 184.68, so I get 184 additional factors of 5 - 5
^{3}: 4617 ÷ 125 = 36.936, so I get 36 additional factors of 5 - 5
^{4}: 4617 ÷ 625 = 7.3872, so I get 7 additional factors of 5 - 5
^{5}: 4617 ÷ 3125 = 1.47744, so I get 1 more factor of 5 - 5
^{6}: 4617 ÷ 15625 = 0.295488, which is less than 1, so I stop here.

Then this factorial has 923 + 184 + 36 + 7 + 1 equals 1151, so:

4617! has 1151 trailing zeroes.

By the way, you can get the same result, *if* you keep track as you go, by just dividing repeatedly in your calculator by 5's:

- 4617 ÷ 5 = 923.4 (write down 923)
- 923.4 ÷ 5 = 184.68 (write down 184)
- 184.68 ÷ 5 = 36.936 (write down 36)
- 36.936 ÷ 5 = 7.3827 (write down 7)
- 7.3827 ÷ 5 = 1.47744 (write down 1)
- 1.47744 ÷ 5 < 1 (so don't write anything down)

At which point, you're done doing divisions.

Turn to your scratch paper where you've written down the whole numbers (namely, 923,184, 36, 7, and 1), and add them up to get 1151, as before.

In general, software like Excel won't help with this sort of computation, any more than your calculator could. Software customarily only stores fifteen or so digits of "accuracy", which is why, after a number gets sufficiently large, the display switches automatically to scientific notation.

Since the software is only storing the first few leading digits, the remaining trailing digits have to be filled in with zeroes. If you attempt the first expansion above, "23!", in Excel, you'll get something with way more trailing zeroes than is actually correct. In other words, the computer will give you the wrong answer.

So learn the concepts; don't try to cheat with software.

URL: https://www.purplemath.com/modules/factzero.htm

© 2024 Purplemath, Inc. All right reserved. Web Design by