j += i
sum = 0
t = i
while t <= number:
    sum += number / t
t *= i
if i == 2:
    factor2 = sum
elif i == 5:
    factor5 = sum
else:
    result *= i ** sum
return (result << factor2 - factor5) * 10 ** factor5
Calculating the factorial without trailing zeros efficiently?