@@ -6,12 +6,12 @@ Number of trailing zeros in the factorial of an integer
66:slug: trailing-zeros-factorial
77:summary: Use Python to find the number of trailing zeros in the factorial of an integer
88
9- Please note, the math expressions are broken. I will be fixing it soon.
10-
119Hi all, I recently learned about a cool formula to calculate the number of
1210trailing zeros in the factorial of a number. It has been a while since I
1311wrote a program to do something like this. So, I decided to change that and
14- write this blog post. In the spirit of wring various "calculators", we will
12+ write this blog post.
13+
14+ In the spirit of wring various "calculators", we will
1515write a "number of trailing zero" calculator. First up though, let's refresh
1616some key relevant concepts.
1717
@@ -28,10 +28,12 @@ and that of 3.5 is 3 and the floor of 3 is 3 as well.
2828Now, coming back to the focus of this post, this document at brilliant.org wiki
2929explains the process in `detail <https://brilliant.org/wiki/trailing-number-of-zeros/ >`__.
3030
31- The key bit there in is this formula: :math: `\sum _{i=0 }^{k}\floor *{\frac {n}{5 ^i}}`
31+ The key bit there in is this formula:
32+
33+ .. figure :: {filename}/images/trailing_zeros_formula.png
34+
3235
33- where, ``n `` is the number for whose factorial we want to find the number of trailing zeros in and ``k ``
34- is defined as:
36+ where, ``n `` is the number for whose factorial we want to find the number of trailing zeros.
3537
3638The following Python program implements the above formula:
3739
0 commit comments