Last $500$ digits of $2015!-1$ As the title says, I'm looking for the last $500$ digits of $2015!-1$. I assume it's a repetition of zeroes from the factorial, so the final result is a lot of $9$-s, but I can't formulate a solution in a mathematical way. I know that $201$ zeroes come from $10$-s in there, also, $202$ from the $5$-s that are multiplied by even numbers, $20$ extra from the $100$-s, $2$ more from the $1000$-s, but I'm still missing a couple.
 A: As pointed out by user236182, Legendre's Formula, proven in $(3)$ of this answer, says that for any prime $p$, the number of factors of $p$ in $n!$ is
$$
\frac{n-\sigma_p(n)}{p-1}
$$
where $\sigma_p(n)$ is the sum of the digits in the base-$p$ representation of $n$.
Since $2015_{\text{ten}}=31030_{\text{five}}$, the sum of the base $5$ digits is $7$ so the number of powers of $5$ in $2015!$ is
$$
\frac{2015-7}{5-1}=502
$$
There are more factors of $2$ so there are $502$ trailing zeroes for $2015!$. Therefore, the last $500$ digits of $2015!-1$ are all nines.
A: There are 403 numbers between 1 and 2015 are divisible by 5. Not all of them contribute just one factor of 5.
The multiples of 25 contribute two factors of 5 (there are 80 such). We already have 483 factors of 5.
A further 16 numbers are divisible by 125 and they contribute yet another factor of 5. We're now up to 499 factors of 5.
Finally, the multiples of 625 contribute yet another factor, and there are 3 such numbers. So we have at least 502 factors of 5 in 2015!. (There are in fact exactly 502 factors, but that's not important here).
There is no dearth of factors of 2, which occur more often than the factors of 5. So we know that $10^{502}$ divides 2015!. I think you know what to do from here!
A: The following formula denotes the number of times that a prime factor $p$ appears in $n!$:
$$C_{n}(p)=\sum\limits_{k=1}^{\infty}\left\lfloor\frac{n}{p^k}\right\rfloor$$

Since $\lfloor\log_{\color\green{2}}2015\rfloor=\color\red{10}$:
$$C_{2015}(\color\green{2})=\sum\limits_{k=1}^{\color\red{10}}\left\lfloor\frac{2015}{\color\green{2}^k}\right\rfloor=2005$$

Since $\lfloor\log_{\color\green{5}}2015\rfloor=\color\red{4}$:
$$C_{2015}(\color\green{5})=\sum\limits_{k=1}^{\color\red{4}}\left\lfloor\frac{2015}{\color\green{5}^k}\right\rfloor=502$$

Let $Z_{n}$ denote the number of trailing zeros in the decimal representation of $n!$:
$$Z_{n}=\min\{C_{n}(2),C_{n}(5)\}$$

So $Z_{2015}=\min\{2005,502\}=502$, and therefore $2015!$ ends with $502$ zeros.
Since $2015!$ ends with $502$ zeros, the last $502$ digits of $2015!-1$ are all nines.
