Recently a friend of mine suggested a question, which was to find the number of trailing zeroes in $(100!)$.
While that should be easy enough to tackle, as I have seen a lot of questions on MSE that deal with exactly this type of problem, I would like to solve a more general problem:
Define a function $f(n)$ using common mathematical operators and other notation that counts the number of trailing zeroes in a given positive integer $n$
Now I have got something in mind, which is: $$f(x)=\sum_{i=1}^{\lfloor log_{10}x\rfloor} \left(1-|sgn(x\mod(10^i)|\right)$$ Where $sgn()$ is the signum function. The function is based on the concept of checking if the number is divisible by successive powers of $10$. Here’s a Desmos link for the function.
While this does seem to work, I would like a more compact function that I can actually work with, while this is something like rewriting a computer algorithm, only using mathematical notation.
All ideas are welcome.
Thanks in advance.
EDIT: As proposed in a comment by @RobertIsrael, another definition for the function is:
$$\min(v_{2}(n), v_{5}(n))$$
with reference to the $p$-adic valuation of $n$.