I was on math.stackexchange the other day and i found a question that said How many zeroes are there in 100!. I quickly factored it out and said that there where 24 zeroes. However thats only the trailing zeroes (as the person who asked the question quickly pointed out). As the days passed no one answered the question. My question is the following: is there a method to figure it out without having to compute the whole answer? I initially thought that it could be solved using many divisibility properties but I didn't figure anything out.

Using well known approximations for the length and number of trailing zeroes of n!, and making the reasonable assumption that the inside zeros appear with frequency $\frac{1}{10}$, we get the following approximation of the total number of zeros, t, in n!: $t = \lfloor \frac{1}{10}(\frac{\log (2 \Pi n)}{2}+n\log (\frac{n}{e}) \frac{n}{4}+ \log(n)) + \frac{n}{4}  log(n)\rfloor $ Which simplifies to: $t = \lfloor \frac{n (9 \ln (10)4)+4 (n9) \ln (n)+2 \ln(2 \Pi n)}{40 \ln(10)} \rfloor$ This approximation seems to work well for n up to at least 10,000. 100!, with digit length 158, has less inside zeroes, 6, with 24 trailing, than the normal expectation for a total of 30, with t=36. 98! is "zeroperfect", i.e. inside zeroes appear with exactly frequency $1/10$, with actual total zero count 35 and $t = 35$ Other examples of zeroperfect factorials are: 1009!, 1097!, 1112!, 2993!, 6128!, .... There appears to be a strong correlation of n having only 03 prime factors in {2, 3, 5} if n! is zeroperfect. Uneven n is often a prime number if n! is zeroperfect. 


It is unlikely. There are ways to compute the nth digit of certain numbers in certain bases (for example, pi in base 16) without having to compute the entire number, but in most situations, the number or formula for it either has very special properties (e.g. 101*10^n) in order to answer the question, or the work done to answer the question is tantamount to calculating the number, writing it down, and counting the digits. Not only do I know of no way to answer the question otherwise, I will wager a small amount of money that no such nice way will posted here for the next 2 years. Gerhard "Willing To Formalize The Bet" Paseman, 2012.07.12 


EDIT: this doesn't really work. I'm still a good human being. Evenly enough, it seems possible to get the number of zeros in the binary expansion of $n!$ One can get a fairly accurate expression for $$\log_2 \; n! = \frac{\log \; n!}{\log 2}$$ from using extra terms in Stirling's formula. Taking the floor of that and adding 1 gives the total number of digits in base two.. Legendre's formula $$ v_2(n!) = \left\lfloor \frac{n}{2} \right\rfloor + \left\lfloor \frac{n}{4} \right\rfloor + \cdots $$ has a companion, $$ v_p(n!) = \frac{n  S_p(n)}{p1} $$ where $S_p(n)$ is the sum of the digits when $n$ is written in base $p.$ As all the digits in a base two expansion are $1,$ we find that $S_2(n)$ is simply the count of 1's in the base two expansion of $n.$ Alright, some people, who shall remain nameless, have attempted to cast aspersions on the reputation of your humble servant, pointing out that the number of ones in the binary expansion of $n!$ is not the same as the number of ones in the binary expansion of $n$ itself. I try so hard. Don't change the light bulb, I'll just sit here in the dark. 


Given a prime $p$, it occurs $m$ times in the prime factorization of $n!$, where m = $ \lfloor \frac{n}{p} \rfloor + \lfloor \frac{n}{p^2} \rfloor + \lfloor \frac{n}{p^3} \rfloor + \cdots $ This is explained in many number theory books. Apply this for $p=2$ and $p=5$, and use the value you get for 5, since this occurs many fewer times. Tom 

