Learning Scientific Programming with Python (2nd edition)

P2.5.6: de Polignac's formula

Question P2.5.6

Write a Python program to determine $f(n)$, the number of trailing zeros in $n!$, using the special case of de Polignac's formula: $$ f(n) = \sum_{i=1} \left\lfloor \frac{n}{5^i} \right\rfloor, $$ where $\lfloor x \rfloor$ denotes the floor of $x$, the largest integer less than or equal to $x$.