Last $500$ digits of $2015!-1$

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!


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.