结论:
f(N) = f(N/5) + N/5, N >= 5
f(N) = 0, N < 5
证明:
1)N < 5时,很显然的f(N) = 0
2)设对所有的小于N的数,命题成立。那么N时:
N = N * ... * (5*N/5) * ... * (5*(N/5 - 1)) * ... * (5*1) * 4 * 3 * 2 * 1
= 5^(N/5) * (N/5) * (N/5 - 1) * ... * 1 * a
其中a的因式分解无5。由于[5*i, 5*(i+1)] 0 <= i <= (N/5 - 1)之间存在偶数,因此5^(N/5)每个5都给N!的末尾贡献一个0,
应此f(N) = f(N/5) + N/5