# Difference between revisions of "2010 AMC 12A Problems/Problem 23"

## Problem

The number obtained from the last two nonzero digits of $90!$ is equal to $n$. What is $n$?

$\textbf{(A)}\ 12 \qquad \textbf{(B)}\ 32 \qquad \textbf{(C)}\ 48 \qquad \textbf{(D)}\ 52 \qquad \textbf{(E)}\ 68$

## Hints and Method of Attack

Let $P$ be the result of dividing $90!$ by tens such that $P$ is not divisible by 10. We want to consider $P \mod 100$. But because 100 is not prime, and because $P$ is obviously divisible by 4 (if in doubt, look at the answer choices), we only need to consider $P \mod 25$.

However, 25 is a very particular number. $1 * 2 * 3 * 4 \equiv -1 \mod 25$, and so is $6 * 7 * 8 * 9$. How can we group terms to take advantage of this fact?

There might be a problem when you cancel out the 10s from $90!$. One method is to cancel out a factor of 2 from an existing number along with a factor of 5. But this might prove cumbersome, as the grouping method will not be as effective. Instead, take advantage of inverses in modular arithmetic. Just leave the negative powers of 2 in a "storage base," and take care of the other terms first. Then, use Fermat's Little Theorem to solve for the power of 2.

## Solution

We will use the fact that for any integer $n$, \begin{align*}(5n+1)(5n+2)(5n+3)(5n+4)&=[(5n+4)(5n+1)][(5n+2)(5n+3)]\\ &=(25n^2+25n+4)(25n^2+25n+6)\equiv 4\cdot 6\\ &=24\pmod{25}\equiv -1\pmod{25}.\end{align*}

First, we find that the number of factors of $10$ in $90!$ is equal to $\left\lfloor \frac{90}5\right\rfloor+\left\lfloor\frac{90}{25}\right\rfloor=18+3=21$. Let $N=\frac{90!}{10^{21}}$. The $n$ we want is therefore the last two digits of $N$, or $N\pmod{100}$. If instead we find $N\pmod{25}$, we know that $N\pmod{100}$, what we are looking for, could be $N\pmod{25}$, $N\pmod{25}+25$, $N\pmod{25}+50$, or $N\pmod{25}+75$. Only one of these numbers will be a multiple of four, and whichever one that is will be the answer, because $N\pmod{100}$ has to be a multiple of 4.

If we divide $N$ by $5^{21}$ by taking out all the factors of $5$ in $N$, we can write $N$ as $\frac M{2^{21}}$ where $$M=1\cdot 2\cdot 3\cdot 4\cdot 1\cdot 6\cdot 7\cdot 8\cdot 9\cdot 2\cdots 89\cdot 18,$$ where every multiple of 5 is replaced by the number with all its factors of 5 removed. Specifically, every number in the form $5n$ is replaced by $n$, and every number in the form $25n$ is replaced by $n$.

The number $M$ can be grouped as follows:

\begin{align*}M= &(1\cdot 2\cdot 3\cdot 4)(6\cdot 7\cdot 8\cdot 9)\cdots(86\cdot 87\cdot 88\cdot 89)\\ &\cdot (1\cdot 2\cdot 3\cdot 4)(6\cdot 7\cdot 8\cdot 9)\cdots (16\cdot 17\cdot 18) \\ &\cdot (1\cdot 2\cdot 3).\end{align*}

Where the first line is composed of the numbers in $90!$ that aren't multiples of five, the second line is the multiples of five and not 25 after they have been divided by five, and the third line is multiples of 25 after they have been divided by 25.

Using the identity at the beginning of the solution, we can reduce $M$ to

\begin{align*}M&\equiv(-1)^{18} \cdot (-1)^3(16\cdot 17\cdot 18) \cdot (1\cdot 2\cdot 3) \\ &= 1\cdot -21\cdot 6\\ &= -1\pmod{25} =24\pmod{25}.\end{align*}

Using the fact that $2^{10}=1024\equiv -1\pmod{25}$ (or simply the fact that $2^{21}=2097152$ if you have your powers of 2 memorized), we can deduce that $2^{21}\equiv 2\pmod{25}$. Therefore $N=\frac M{2^{21}}\equiv \frac {24}2\pmod{25}=12\pmod{25}$.

Finally, combining with the fact that $N\equiv 0\pmod 4$ yields $n=\boxed{\textbf{(A)}\ 12}$.

## Solution 2

Let $P$ be $90!$ after we truncate its zeros. Notice that $90!$ has exactly (floored) $\lfloor\frac{90}{5}\rfloor + \lfloor\frac{90}{25}\rfloor = 21$ factors of 5; thus, $$P = 2^{-21}*5^{-21}*90!.$$ We shall consider $P$ modulo 4 and 25, to determine its residue modulo 100. It is easy to prove that $P$ is divisible by 4 (consider the number of 2s dividing $90!$ minus the number of 5s dividing $90!$), and so we only need to consider $P$ modulo 25.

Now, notice that for integers $a, n$ we have$$(5n + a)(5n - a) \equiv -a^2 \mod 25.$$

Thus, for integral a: $$(10a + 1)(10a + 2)(10a + 3)(10a + 4)(10a + 6)(10a + 7)(10a + 8)(10a + 9) \equiv (-1)(-4)(-9)(-16) \equiv 576 \equiv 1 \mod 25.$$ Using this process, we can essentially remove all the numbers which had not formerly been a multiple of 5 in $90!$ from consideration.

Now, we consider the remnants of the 5, 10, 15, 20, ..., 90 not yet eliminated. The 10, 20, 30, ..., 90 becomes 1, 2, 3, 4, 1, 6, 7, 8, 9, whose product is 1 mod 25. Also, the 5, 5, 15, 25, ..., 85 becomes 1, 1, 3, 1, 7, 9, 11, 13, 3, 17 and $2^{-12}$. We deduce that from multiplying out the 1, 1, 3, 1, 7, ..., 17 is equivalent to 2 modulo 25, and so we need to compute $2^{-11}$. But this is simply by Fermat's Little Theorem $2^9 = 512 \equiv 12 \mod 25$. Because 12 is also a multiple of 4, we can utilize the Chinese Remainder Theorem to show that $P = 12 \mod 100$ and so the answer is $\boxed{12}$.