Trailing zeroes of $\dfrac{n!}{m!}$ for $n>m$

78 Views Asked by At

I (as a teacher) saw in a book for $8^{th}$ grade students that the number of trailing zeroes of ${n!}\times{m!}$ is the sum of the trailing zeroes of $n!$ and $m!$. There also has been noticed that the number of trailing zeroes of $\dfrac{n!}{m!}$ ($m<n$) is their subtraction. i.e.

$$(\left\lfloor \frac{n}{5}\right\rfloor+ \left\lfloor \frac{n}{5^2}\right\rfloor+ \left\lfloor \frac{n}{5^3}\right\rfloor+\cdots)-(\left\lfloor \frac{m}{5}\right\rfloor+ \left\lfloor \frac{m}{5^2}\right\rfloor+ \left\lfloor \frac{m}{5^3}\right\rfloor+\cdots).$$

But I think this is wrong because for example $\dfrac{15!}{14!}=15$ but $3-2=1$.

Can one prove that this statement is correct if $n>m-1$? If so why this restriction is necessary?

Of course it is obvious that $\dfrac{(n+1)!}{n!}=n+1$ and the number of trailing zeroes depend on the number of trailing zeroes of the number $n+1$.

Where does this strange behavior comes from? i.e. in product of factorials we sum number of trailing zeroes but in division we should care about it?

Note: I always make mistakes in simple math calculations. Am I wrong here?

2

There are 2 best solutions below

2
On BEST ANSWER

The formula will be wrong lots of times. For example, $125!/122!$ has two trailing $0$’s, while the formula suggests $3$. The problem is that there are more $5$’s in the factorization than $2$’s.

If you calculate the corresponding formula for $2$ and take the minimum of the two values, you’ll correct the formula.

The formula that is stated counts the number of $5$'s in the factorization of the quotient $\frac{n!}{m!}$. Usually, in factorials, $5$ is scarcer than $2$. In the quotient, however, it is possible that $2$ becomes rarer. Therefore, if you take the formula that counts the number of $2$'s, you'll see that, for example, $\frac{15!}{14!}$ has $(7+3+1)-(7+3+1)=0$ factors of $2$, so it has no trailing $0$'s.

1
On

Let $\lfloor r\rfloor$ denote the floor of $r$.

For prime $p$ and positive integer $n$, let
$V_p(n)$ denote the largest exponent $\alpha$
such that $p^{\alpha} | n.$
Note that under this definition
$p^{(\alpha + 1)} \not | n.$

The formula for $V_p(n!)~$ is $~\lfloor \frac{n}{p^1}\rfloor ~+~ \lfloor \frac{n}{p^2}\rfloor ~+~ \lfloor \frac{n}{p^3}\rfloor ~+~ \lfloor \frac{n}{p^4}\rfloor ~+~ \cdots $

Using this formula, the precise formula for the # of trailing zeros that
a number will have is $\min\{V_2(n), V_5(n)\}.$

It's easy to see that in general, $V_5(n!) \leq V_2(n!).$

I recommend against any attempt to shortcut the formula.
For example, if $n > m$, there is no way to guarantee that
$V_5(n!) - V_5(m!) = m - n.$

In fact, one of the ways of showing that
$\binom{n}{k}$ is an integer,
when $~n ~\in ~\mathbb{Z^+}$ and $k \in \{0,1,\cdots, n\}$
is by showing that for any prime $p$,
$V_p(n!) \geq \{V_p(k!) + V_p([n-k]!)\}.$

Addendum
I really didn't focusing on the internals of where the OP's computation could lead to the wrong result.

Therefore, see also Michael Burr's subsequent comment to this answer.