# 2015 AMC 10B Problems/Problem 23

## Problem

Let $n$ be a positive integer greater than 4 such that the decimal representation of $n!$ ends in $k$ zeros and the decimal representation of $(2n)!$ ends in $3k$ zeros. Let $s$ denote the sum of the four least possible values of $n$. What is the sum of the digits of $s$?

$\textbf{(A) }7\qquad\textbf{(B) }8\qquad\textbf{(C) }9\qquad\textbf{(D) }10\qquad\textbf{(E) }11$

## Solution

### Solution 1

A trailing zero requires a factor of two and a factor of five. Since factors of two occur more often than factors of five, we can focus on the factors of five. We make a chart of how many trailing zeros factorials have:

$$\begin{array}{c|c|c|c|c|c|c} \mathrm{Factorial}&0!-4!&5!-9!&10!-14!&15!-19!&20!-24!&25!-29!\\\hline \mathrm{Zeros}&0&1&2&3&4&6 \end{array}$$

We first look at the case when $n!$ has $1$ zero and $(2n)!$ has $3$ zeros. If $n=5,6,7$, $(2n)!$ has only $2$ zeros. But for $n=8,9$, $(2n)!$ has $3$ zeros. Thus, $n=8$ and $n=9$ work.

Secondly, we look at the case when $n!$ has $2$ zeros and $(2n)!$ has $6$ zeros. If $n=10,11,12$, $(2n)!$ has only $4$ zeros. But for $n=13,14$, $(2n)!$ has $6$ zeros. Thus, the smallest four values of $n$ that work are $n=8,9,13,14$, which sum to $44$. The sum of the digits of $44$ is $\boxed{\mathbf{(B)\ }8}$

### Solution 2

By Legendre's Formula and the information given, we have that $3\left(\left\lfloor{\frac{n}{5}}\right\rfloor+\left\lfloor{\frac{n}{25}}\right\rfloor\right)=\left\lfloor{\frac{2n}{5}}\right\rfloor+\left\lfloor{\frac{2n}{25}}\right\rfloor$.

Trivially, it is obvious that $n<100$ as there is no way that if $n>100$, $n!$ would have $3$ times as many zeroes as $(2n)!$.

First, let's plug in the number $5$ We get that $3(1)=1$, which is obviously not true. Hence, $n>5$

After several attempts, we realize that the RHS needs $1$ to $2$ more "extra" zeroes than the LHS. Hence, $n$ is greater than a multiple of $5$.

Very quickly, we find that the least $4 n's$ are $8,9,13,14$.

$8+9+13+14=17+27=44\implies 4+4=8\implies\boxed{B}$.

### Solution 3 (Bashing)

We notice that for a $0$ to be at the end of a factorial, one multiple of five must be there. Therefore, it is intuitive to start at $5$ and work up. If you bash enough you get $8$, $9$, $13$, and $14$. Going any higher will give too many zeros, and then we can stop going higher. $8+9+13+14=17+27=44\implies 4+4=8\implies\boxed{\textbf{(B) }8}$.

### Solution 4

Let $n=5m+k$ for some natural numbers $m$, $k$ such that $k\in\{0,1,2,3,4\}$. Notice that $n<5^3=125$. Thus $$3(\lfloor\frac{n}{5}\rfloor+\lfloor\frac{n}{25}\rfloor)=\lfloor\frac{2n}{5}\rfloor+\lfloor\frac{2n}{25}\rfloor+\lfloor\frac{2n}{125}\rfloor$$ For smaller $n$, we temporarily let $\lfloor\frac{2n}{125}\rfloor=0$ $$3(\lfloor\frac{n}{5}\rfloor+\lfloor\frac{n}{25}\rfloor)=\lfloor\frac{2n}{5}\rfloor+\lfloor\frac{2n}{25}\rfloor$$ $$3(\lfloor\frac{5m+k}{5}\rfloor+\lfloor\frac{5m+k}{25}\rfloor)=\lfloor\frac{2(5m+k)}{5}\rfloor+\lfloor\frac{2(5m+k)}{25}\rfloor$$ $$3(\lfloor\frac{5m+k}{5}\rfloor+\lfloor\frac{5m+k}{25}\rfloor)=\lfloor\frac{10m+2k}{5}\rfloor+\lfloor\frac{10m+2k}{25}\rfloor$$ $$3m+3\lfloor\frac{5m+k}{25}\rfloor=2m+\lfloor\frac{2k}{5}\rfloor+\lfloor\frac{10m+2k}{25}\rfloor$$ $$m+3\lfloor\frac{5m+k}{25}\rfloor=\lfloor\frac{2k}{5}\rfloor+\lfloor\frac{10m+2k}{25}\rfloor$$ To minimize $n$, we let $\lfloor\frac{5m+k}{25}\rfloor=\lfloor\frac{10m+2k}{25}\rfloor=0$, then $$m=\lfloor\frac{2k}{5}\rfloor$$ Since $k<5$, $m>0$, the only integral value of $m$ is $1$, from which we havve $k=3,4\Longrightarrow n=8,9$.

Now we let $\lfloor\frac{5m+k}{25}\rfloor=0$ and $\lfloor\frac{10m+2k}{25}\rfloor=1$, then $$m=\lfloor\frac{2k}{5}\rfloor+\lfloor\frac{10m+2k}{25}\rfloor$$ Since $k<5$, $10m>15\Longrightarrow m\ge2$.

If $m>2$, then $$m>\lfloor\frac{2k}{5}\rfloor+\lfloor\frac{10m+2k}{25}\rfloor$$ which is a contradiction.

Thus $m=2\Longrightarrow\lfloor\frac{2k}{5}\rfloor=1\Longrightarrow n=13,14$

Finally, the sum of the four smallest possible $n=8+9+13+14=44$ and $4+4=8$. $\boxed{\mathrm{(B)}}$

~ Nafer