<s>[INST] Trailing zeroes in factorials: are there any excluded values divisible by 5 other than $5$ and $30$? I've discovered that when this algorithm for counting zeroes on the end of $n!$ is applied to some $n\in\Bbb{N}$: $$f(n)=\sum_{k=1}^{k:n/5^k\le1}\left\lfloor\frac{n}{5^k}\right\rfloor\notin\{5,30\}$$ Are the any other numbers $n:5|n$ that I could add to the set?
Now, a companion question would be: What are the multiples of $2$ that get skipped?
Just because a number gets skipped, doesn't mean it's divisible by $5$; I found $40!$ to $49!$ have $10$ trailing zeroes, but $50!$ has $12$, skipping $11$. $$f(n)\notin\{5,11,17,18,23,29,30,...\}$$
Am I doing something wrong, or are these numbers supposed to be skipped?
 [/INST] For $k \geqslant 2$, we have
$$f(5^k) = \frac{5^k-1}{5-1} \equiv 1 \pmod{5},$$
so the multiple
$$\frac{5^{k-1}-1}{4}\cdot 5$$
of $5$ is skipped. That produces the sequence $5,5+5^2 = 30, 5+5^2+5^3 = 155, 155+5^4 = 780,\dotsc$ of skipped multiples of $5$.
There are more, for example $f(350) = 70+14+2 = 86$, so $85$ is skipped. Generally, if we call $s_5(n)$ the sum of the digits in the base-$5$ representation of $n$, then we have
$$f(n) = \frac{n-s_5(n)}{4}.$$
$f(n)$ skips $k-1$ values when $n$ is a multiple of $5^k$ but not of $5^{k+1}$, and among the skipped values is a multiple of $5$ whenever $k-1 \geqslant 5$, or the remainder of $f(n)$ modulo $5$ is between $1$ and $k-1$ (inclusive). The latter condition translates to $1 \leqslant s_5(n) \bmod{5} \leqslant k-1$ for $2 \leqslant k \leqslant 5$, and I used that to find the example $350 = 2\cdot 5^3 + 4\cdot 5^2$ as the smallest number that is not a power of $5$ and leads to a skipped multiple of $5$ in the $f(n)$ sequence.
</s>