Write a program that will calculate the number of trailing zeros in a factorial of a given number.

`N! = 1 * 2 * 3 *  ... * N`

Be careful `1000!` has 2568 digits...

For more info, see: http://mathworld.wolfram.com/Factorial.html 

## Examples

```python
zeros(6) = 1
# 6! = 1 * 2 * 3 * 4 * 5 * 6 = 720 --> 1 trailing zero

zeros(12) = 2
# 12! = 479001600 --> 2 trailing zeros
```

*Hint: You're not meant to calculate the factorial. Find another way to find the number of zeros.*

Difficulty: EASY
Tags: Mathematics

Starter code:
def zeros(n):
	

Solutions:
def zeros(n):
	pow_of_5 = 5
	zeros = 0
	while n >= pow_of_5:
		zeros += n // pow_of_5
		pow_of_5 *= 5
	return zeros


def zeros(n):
	zeros = 0
	i = 5
	while n // i > 0:
		zeros += n // i
		i *= 5
	return zeros


def zeros(n):
	return 0 if int(n / 5) < 1 else int(n / 5) + int(zeros(n / 5))


def zeros(n):
	count = 0
	while n:
		n = n // 5
		count += n
	return count


import math

def zeros(n):
	if n >= 5:
		return math.floor(n / 5) + zeros(n / 5)
	else:
		return 0


def find_factor(p, n):
	(result, power) = (0, p)
	while power < n:
		result += n // power
		power *= p
	return result

def zeros(n):
	return min((find_factor(p, n) for p in (2, 5)))


from math import log, floor

def zeros(n):
	if n < 5:
		return 0
	powers = range(1, floor(log(n, 5)) + 1)
	return sum((n // div for div in (5 ** pw for pw in powers)))


from math import log, ceil

def zeros(n):
	return sum((n // 5 ** i for i in range(1, ceil(log(n, 5))))) if n > 0 else 0


def zeros(n):
	res = 0
	while n >= 5:
		res += n // 5
		n //= 5
	return res


def zeros(n):
	c = 0
	r = 1
	while 5 ** r <= n:
		c += len(range(5 ** r, n + 1, 5 ** r))
		r += 1
	return c


def zeros(n):
	a = n // 5
	if a >= 5:
		return a + zeros(a)
	else:
		return a


def zeros(n):
	sum = 0
	for i in range(1, 30):
		sum += n // 5 ** i
	return sum


def zeros(n):
	result = 0
	i = 5
	while n / i >= 1:
		result += int(n / i)
		i *= 5
	return int(result)


def zeros(n):
	(c, x) = (0, 5)
	while n > x:
		c += n // x
		x *= 5
	return c


from math import floor

def zeros(n):
	sum = 0
	power = 1
	while n / 5 ** power >= 1:
		sum += floor(n / 5 ** power)
		power += 1
	return sum


def zeros(n):
	(i, j) = (1, 0)
	while 5 ** i <= n:
		(i, j) = (i + 1, j + int(n / 5 ** i))
	return j


def zeros(n):
	(base, total) = (5, 0)
	while n > base:
		total += n // base
		base *= 5
	return total


def zeros(n):
	p = 0
	sum = 0
	while n > 5 ** p:
		p += 1
		sum += n // 5 ** p
	return sum


from itertools import takewhile, count
from operator import truth

def zeros(n):
	return sum(takewhile(truth, (n // 5 ** e for e in count(1))))


zeros = lambda n: n // 5 + zeros(n / 5) if n / 5 else 0


from itertools import count, takewhile
pow5 = lambda x: 5 ** x

def zeros(n):
	okay = lambda x: x <= n
	val = lambda x: n // x
	return sum(map(val, takewhile(okay, map(pow5, count(1)))))


def zeros(n):
	if n / 5 <= 0:
		return 0
	else:
		n //= 5
		return n + zeros(n)


import math

def zeros(n):
	if n == 0:
		return 0
	fives = 0
	log5n = int(math.log10(n) / math.log10(5))
	for i in range(1, log5n + 1):
		fives += int(n / 5 ** i)
	return int(fives)


def zeros(n):
	count = 0
	i = 5
	while n / i >= 1:
		count += int(n / i)
		i *= 5
	return int(count)


def zeros(n):
	print(n)
	return int(n / 5 * 1.24999999)


def zeros(n):
	t = 5
	s = 0
	while n > t:
		s += n // t
		t *= 5
	return s


import math

def zeros(n):
	Zeros = 0
	i = 5
	while i <= n:
		Zeros += math.floor(n / i)
		i *= 5
	return Zeros


def zeros(n):
	return sum((n // 5 ** i for i in range(1, 20)))


import math

def zeros(n):
	return 0 if n < 2 else sum([n // 5 ** f for f in range(1, max(2, int(math.log(n)))) if 5 ** f <= n])


import math

def zeros(n: int):
	if n < 5:
		return 0
	log_n_5 = int(math.log(n, 5))
	return sum([n // 5 ** i for i in range(1, log_n_5 + 1)])


def zeros(n):
	n = n // 5
	number = n
	while n != 0:
		n = n // 5
		number += n
	return number


def zeros(n):
	i = 1
	res = 0
	while 5 ** i < n:
		res += n // 5 ** i
		i += 1
	return res


import math

def zeros(n):
	sum = 0
	if n < 5:
		return 0
	for i in range(1, math.floor(math.log(n, 5) + 1)):
		sum += math.floor(n / pow(5, i))
	return sum


def zeros(n):
	num_5 = n
	num_2 = n
	n_5 = 0
	n_2 = 0
	while num_5 != 0:
		n_5 += num_5 // 5
		num_5 = num_5 // 5
	return n_5


from math import factorial

def zeros(n):
	if n == 0:
		return 0
	cnt = 0
	div_num = 5
	while n / div_num >= 1:
		cnt += int(n / div_num)
		div_num *= 5
	return cnt


def zeros(n):
	count = 0
	divider = 5
	while n / divider >= 1:
		count += int(n / divider)
		divider *= 5
	return int(count)


import math

def zeros(n):
	count = 0
	if n == 0:
		return 0
	else:
		k_max = math.floor(math.log(n, 5))
		for i in range(k_max):
			ans = math.floor(n / 5 ** (i + 1))
			count = count + ans
		return count


def zeros(n):
	divisor = 5
	count = 0
	while n > divisor:
		count = count + int(n / divisor)
		divisor *= 5
	return count


def zeros(n):
	if n == 0:
		return 0
	value = 0
	i = 1
	while True:
		if n > 5 ** i:
			value += n // 5 ** i
		else:
			return value
		i += 1


def zeros(n):
	return sum([n // 5 ** i for i in range(1, len(str(n)) + len(str(n // 1000 + 1)))])


def zeros(n):
	x = 0
	z = 5
	while n > 0:
		n /= 5
		x += int(n)
	return x


def zeros(n):
	i = 5
	count_5 = 0
	while n // i >= 1:
		count_5 += n // i
		i *= 5
	return count_5


import math

def zeros(n):
	if n <= 0:
		return 0
	k_max = math.floor(math.log(n, 5)) + 1
	sum = 0
	for k in range(1, k_max):
		sum += math.floor(n / 5 ** k)
	return sum


def zeros(n):
	(i, count) = (20, 0)
	while i > 0:
		count += n // 5 ** i
		i -= 1
	return count


def zeros(n):
	answer = 0
	for i in range(1, 100):
		answer += int(n / 5 ** i)
	return answer


def zeros(n):
	sum = 0
	d = 5
	while d <= n:
		sum += n // d
		d *= 5
	return sum


def zeros(n):
	p = n // 5
	t = p
	while t > 0:
		t = t // 5
		p = p + t
	return p


from math import log

def zeros(n):
	if n == 0:
		return 0
	y = 0
	for x in range(1, int(log(n, 5) + 1)):
		y += n // 5 ** x
	return y


def zeros(n):
	final = 0
	if n == 0:
		return 0
	for x in range(1, 15):
		final += n // 5 ** x
	print(final)
	return final


from math import *

def zeros(n):
	res = 0
	i = 5
	while i < n:
		res += floor(n / i)
		i *= 5
	return res


def zeros(n):
	b = 0
	while 5 ** b < n:
		b += 1
	return sum((n // 5 ** c for c in range(1, b)))


def zeros(n):
	result = 0
	power = 1
	while True:
		if 5 ** power > n:
			break
		result += n // 5 ** power
		power += 1
	return result


import math

def zeros(n):
	ret = 0
	if n == 0:
		return 0
	for i in range(1, int(math.log(n) / math.log(5)) + 1):
		ret += n // math.pow(5, i)
	return ret


import math

def zeros(n):
	if n == 0:
		return 0
	z = 0
	kmax = math.floor(math.log(n) / math.log(5))
	for i in range(1, kmax + 1):
		z += math.floor(n / 5 ** i)
	return z


from math import log

def zeros(n):
	if n == 0:
		return 0
	z = 0
	k = 1
	kMax = round(log(n, 5))
	for i in range(k, kMax + 1):
		z += n // 5 ** i
	return z


def zeros(n):
	num_zero = 0
	while n > 0:
		n = n // 5
		num_zero += n
	return num_zero


def zeros(n):
	sums = []
	while n > 5:
		n /= 5
		sums.append(int(n))
	a = 0
	for num in sums:
		a += int(num)
	return int(a)


def zeros(n):
	i = 1
	x = 0
	while 5 ** i <= n:
		x += n // 5 ** i
		i += 1
	return x


from math import log

def zeros(n):
	if n == 0:
		return 0
	z = 0
	i = 1
	while i < log(n, 5):
		z += n // 5 ** i
		i += 1
	return z


import math

def zeros(n):
	zeroes = 0
	k = 1
	while n / 5 ** k > 1:
		zeroes += math.floor(n / 5 ** k)
		k += 1
	return zeroes


def zeros(n):
	zeros = 0
	tmp = n
	while tmp >= 1:
		tmp /= 5
		zeros += int(tmp)
	return zeros


import math

def zeros(n):
	return sum((int(n / math.pow(5, i)) for i in range(1, 15) if int(n / math.pow(5, i)) != 0))


def zeros(n):

	def find_exponent(n, p):
		factor = 0
		p_helper = p
		while n > p_helper:
			factor += int(n / p_helper)
			p_helper *= p
		return factor
	five_exponent = find_exponent(n, 5)
	return five_exponent


def zeros(n):

	def find_exponent(n, p):
		factor = 0
		p_helper = p
		while n > p_helper:
			factor += int(n / p_helper)
			p_helper *= p
		return factor
	two_exponent = find_exponent(n, 2)
	five_exponent = find_exponent(n, 5)
	return min(two_exponent, five_exponent)


import math

def zeros(n):
	count = 0
	i = 5
	while n / i >= 1:
		count += int(n / i)
		i *= 5
	return int(count)