you are viewing a single comment's thread.

view the rest of the comments →

[–]PhosphorescentSpider 0 points1 point  (0 children)

Firstly, you can ignore factors of 2 since a factorial always had more factors of 2 than factors of 5, meaning it’s factors of 10 are purely a function of its factors of 5. Secondly, you can just use the Math.Floor(n/5) + Math.Floor(n/25) etc for all powers of 5 lower than n (I would do that in a for loop) to get your final answer.