trailingzeros
Trailing zeros are the zeros at the end of the decimal representation of a number. They occur when the number is divisible by powers of the base; in decimal, they correspond to factors of 10 in the number. The number of trailing zeros of an integer n in base 10 equals the largest k such that 10^k divides n, which is equivalently the minimum of the exponents of 2 and 5 in the prime factorization of n (v2(n) and v5(n)). For example, 2500 ends with two zeros because 2500 = 2^2 · 5^4, so min(2,4) = 2.
Trailing zeros are particularly studied for factorials. The number of trailing zeros in n! is the sum
More generally, in any base b with prime factorization b = p1^a1 p2^a2 ..., a number n has
Trailing zeros have applications in number theory, combinatorics, and programming, where they indicate divisibility properties and