# 2008 Mock ARML 2 Problems/Problem 7

## Problem

Let $f(x)$ equal the number of zeroes to the right of the rightmost non-zero digit in the decimal form of $x!$, and let $n = \frac {5^{2008} + 2}{3}$. Given that $f(n)$ can be written as $\frac {5^{a} - b}{c}$, where $b$ and $c$ are relatively prime positive integers, $b$ is less than $10^5$, and $c$ is less than $10^2$, find $a + b + c$.

## Solution

Note that $n$ is an integer. From Legendre's Formula, we see that

$$f(n)=\sum_{i=1}^{2007} \lfloor \frac{n}{5^i}\rfloor$$

Now note that the largest multiple of 15 that is less than $5^{2008}+2$ is $5^{2008}+2-12=5^{2008}-10$. Therefore

$$\lfloor \frac{n}{5}\rfloor=\frac{5^{2008}-10}{15}=\frac{5^{2007}-2}{3}$$

We do the same process again: The largest multiple of 15 less than $5^{2007}-2$ is $5^{2007}-2-3=5^{2007}-5$, so

$$\lfloor \frac{n}{25}\rfloor =\lfloor \frac{\lfloor \frac{n}{5}\rfloor}{5}\rfloor = \lfloor\frac{5^{2007}-2}{15}\rfloor$$

$$=\frac{5^{2007}-5}{15}=\frac{5^{2006}-1}{3}$$

Similarly, $\lfloor\frac{n}{125}\rfloor=\frac{5^{2005}-2}{3}$. We then see a pattern;

$$f(n)=\frac{5^{2007}-2}{3}+\frac{5^{2006}-1}{3}+\frac{5^{2005}-2}{3}+\cdots +\frac{5-2}{3}$$

$$=\frac{5^{2007}+5^{2006}+5^{2005}+\cdots +5}{3}-\frac{2\cdot 1004 + 1003}{3}$$

Now note that $5^{2007}+5^{2006}+\cdots +5 = \frac{5^{2008}-5}{3}$, so

$$f(n)=\frac{5^{2008}-5}{12}-\frac{3011}{3}=\frac{5^{2008}-12049}{12}$$

This shows that $(a,b,c)=(2008, 12049, 12)$, so $a+b+c=\boxed{14069}$.