Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know $1000!$ has $\frac{1000}{5}+\frac{1000}{25}+\frac{1000}{125}+\frac{1000}{625}=249$ terminal zeros in decimal notation, but what if we write $1000!$ in base $24$, how many terminal zeros would it have? Is there a way to compute it?


share|cite|improve this question
Is that $1000_{10}!$ or $1000_{24}!$? They are rather different. The approach is the same, however. – Ross Millikan Feb 19 '13 at 17:12
up vote 5 down vote accepted

The power of $2$ in $1000!$ is

$$a=\left\lfloor \frac{1000}{2}\right\rfloor+\left\lfloor\frac{1000}{4}\right\rfloor+\left\lfloor\frac{1000}{8}\right\rfloor+\left\lfloor\frac{1000}{16}\right\rfloor+\left\lfloor\frac{1000}{32}\right\rfloor+\left\lfloor\frac{1000}{64}\right\rfloor+\left\lfloor\frac{1000}{128}\right\rfloor+\left\lfloor\frac{1000}{256}\right\rfloor+\left\lfloor \frac{1000}{512}\right\rfloor$$ The power of $3$ in $1000!$ is


Thus the number of zeroes is $\min \{ \lfloor \frac{a}{3} \rfloor, b \}$.

share|cite|improve this answer
Should not it be min rather than max? – Xentius Feb 19 '13 at 5:34
I believe that each of those fractions should be floored. – robjohn Feb 19 '13 at 11:31
@robjohn Ty fixed... That was a bad mistake, especially since $1000$ is just a bit smaller than $1024$, which would make the floor of all fractions larger... – N. S. Feb 19 '13 at 16:43

For a prime $p$, the number of factors of $p$ in $n!$ is $$ \frac{n-\sigma_p(n)}{p-1} $$ where $\sigma_p(n)$ is the sum of the base $p$ digits for $n$.

In base $2$, $1000_\text{ten}=1111101000_\text{two}$; thus, the number of factors of $2$ in $1000!$ is $\frac{1000-6}{2-1}=994$ which means $331$ factors of $8$.

In base $3$, $1000_\text{ten}=1101001_\text{three}$; thus, the number of factors of $3$ in $1000!$ is $\frac{1000-4}{3-1}=498$.

Thus, the number of factors of $24$ in $1000!$ is $331$.

share|cite|improve this answer

Yes - it is the same concept; essentially, you want to write $1000! = 3^{x}\cdot 8^{y} \cdot \textrm{stuff}.$ Then take the minimum of $x$ and $y$ to get the number of zeros at the end.

share|cite|improve this answer

You need to figure out how many times 24 divides 1000!. Since $24 = 2^3\cdot 3$, figure out how many times $2$ and $3$ divide 1000!. This can be done in exactly the same way you did it above: What you found was the number of times $5$ divided $1000!$.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.