Associated Topics || Dr. Math Home || Search Dr. Math

### Decimal Places in Large Factorials

```Date: 04/29/2003 at 18:33:40
From: Teresa
Subject: Large factorial numbers

Is there an easy way to find how many decimal places or how many zeros
the decimal notation of a large factorial number will have?
```

```
Date: 04/30/2003 at 03:27:02
From: Doctor Roy
Subject: Re: Large factorial numbers

Hi,

Thanks for writing to Dr. Math.

There is a formula for finding the number of zeros a factorial number
will have.

It is:

floor(n/5) + floor(n/25) + floor(n/125) + ... + floor(n/5^n) + ...

The floor function means round down to the nearest integer.

For example, let's take 5!, or n = 5.

floor(5/5) = floor(1) = 1.

So, 5! ends in 1 zero.

Let's go to 15!

floor(15/5) = floor(3) = 3

So, 15! ends in 3 zeros.

Let's move on to 100!.

floor(100/5) + floor(100/25) = floor(20) + floor(4)

= 20 + 4

= 24

If you went to 200, you would have to use the next power of 5, or
5^3 = 125.

The reason this works is that a number ends in 0 if it is divisible by
10. Divisible by 10 means divisible by both 5 and 2. But there are
lots of numbers divisible by 2 (half of them). So, we concentrate on
the number of times a number is divisible by 5. But there are tricky
numbers like 25, which are divisible by 5 twice, so we have to take
those into account (or floor(n/25)). Then again, there are numbers
that are divisible by 5 three times, like 125, so we have to take them
into account.

Does this help?  Please feel free to write back with any questions you
may have.

- Doctor Roy, The Math Forum
http://mathforum.org/dr.math/
```

```
Date: 05/01/2003 at 14:14:27
From: Teresa
Subject: Large factorial numbers

That worked!  Thank you.
```
Associated Topics:
Middle School Factorials

Search the Dr. Math Library:

 Find items containing (put spaces between keywords):   Click only once for faster results: [ Choose "whole words" when searching for a word like age.] all keywords, in any order at least one, that exact phrase parts of words whole words

Submit your own question to Dr. Math
Math Forum Home || Math Library || Quick Reference || Math Forum Search