Article From:https://www.cnblogs.com/wfq9330/p/9558456.html

Actually 1, 2, 3, 4, 6, 7… It can be considered without any consideration, so choose 5 as the iteration step.
First of all, these figures can be avoided.`%5`（For 5 remainder operations, so each cycle can directly function.`count`Variables add 1 directly. Secondly, consider 25, 125, 625… Wait for 5 power terms, because each of them can produce more than 0 after multiplying with even numbers. Therefore, a circular body is set up to determine how many power terms are added and the results are added.`count`。
In summary, the code can be written as follows:

#### ``` 1 public class Solution { 2 3 /* 4 * param n: As desciption return: An integer, denote the number of trailing 5 * zeros in n! 6 */ 7 public long trailingZeros(long n) { 8 // write your code here 9 long count = 0; 10 long pwr = 25; 11 for (long temp = 5; temp <= n; temp+=5) { 12 // forThe temp inside the loop is a multiple of 5, so +1 operation is the first step. 13 count++; 14 pwr = 25; 15 // Is it a multiple of 25, 125, 625? And +1 operation according to the change of PWR? 16 while (temp % pwr == 0) { 17 count++; 18 pwr *= 5; 19 } 20 } 21 return count; 22 } 23 }```

Link of this Article: N! Factorial