Skip to content

Commit 8fcac61

Browse files
committed
Merge pull request smilejay#2 from vvs14/patch-1
Update zero_cnt_of_factorial.py
2 parents 374625f + 25c4bb8 commit 8fcac61

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

py2015/zero_cnt_of_factorial.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,10 @@
55

66
def zero_cnt_of_factorial(num=50):
77
count = 0
8-
delta = 5
9-
m = 5
10-
while m <= num:
11-
count += 1
12-
m1 = m / delta
13-
while m1 > 0:
14-
if m1 % delta == 0:
15-
count += 1
16-
m1 = m1 / delta
17-
m += 5
8+
i=5
9+
while ( (num/i)>=1):
10+
count += num/i
11+
i *= 5
1812
return count
1913

2014
if __name__ == '__main__':

0 commit comments

Comments
 (0)