How do I calculate the number of terminating zeroes in $n!!$
$$ n!!=\prod _{k=0}^{\left\lceil {\frac {n}{2}}\right\rceil -1}(n-2k)=n(n-2)(n-4)\cdots $$
where : $n!!$ is defined as double factorial
How do I calculate the number of terminating zeroes in $n!!$
$$ n!!=\prod _{k=0}^{\left\lceil {\frac {n}{2}}\right\rceil -1}(n-2k)=n(n-2)(n-4)\cdots $$
where : $n!!$ is defined as double factorial
clearly, we can see that $n!!$ cannot have any trailing zeroes if n is odd because there is no multiplier of $2$ in the product.
as
$$n!! = \prod_{k = 0}^{ \bigl\lceil \frac{n}{2}\bigr\rceil - 1} (n - 2k)$$
also, we can write
$$n! = n!! \times (n - 1)!!$$
$$ n!!={\frac {n!}{(n-1)!!}}={\frac {(n+1)!}{(n+1)!!}}$$
where the denominator cancels the unwanted factors in the numerator. (The last form also applies when n = 0.) For an even non-negative integer $n = 2k$ with $k \ge 0$, the double factorial may be expressed as
$$n!! = 2^k k!$$ now we just need to find the number of trailing zeroes in $k = \frac{n}{2}$ i.e.
$$\text{Trailing Zeroes} = \sum_{i = 1}^{\infty} \Biggl\lfloor\frac{n}{2 . 5^{i}}\Biggr\rfloor = \Biggl\lfloor\frac {n}{2 . 5} \Biggr\rfloor+\Biggl\lfloor \frac {n}{2 . 5^2} \Biggr\rfloor+\ldots $$
The number of trailing zeros for even $n$ is tabulated in A027868, which also quotes the formula with the sum of the floor-functions and provides references.