Trailing Zeros of 1000! in Base 12 via Legendre's Formula
Board: Olympiad | Grade: Olympiad | Chapter: Legendre's Formula
Problem
Find the exact number of trailing zeros at the end of $1000!$ when written in base $12$.
Step-by-Step Textbook Solution
The number of trailing zeros of $1000!$ in base $12$ is the largest integer $k$ such that $12^k \mid 1000!$. Since $12 = 2^2 \cdot 3$, we have $12^k = 2^{2k} \cdot 3^k$, so $$k = \min\left(\left\lfloor \frac{v_2(1000!)}{2} \right\rfloor, ; v_3(1000!)\right).$$
Using Legendre's Formula $v_p(n!) = \sum_{j=1}^{\infty} \left\lfloor \frac{n}{p^j} \right\rfloor$:
-
Exponent of $2$: $$v_2(1000!) = 500 + 250 + 125 + 62 + 31 + 15 + 7 + 3 + 1 = 994.$$ Thus $\left\lfloor \frac{v_2(1000!)}{2} \right\rfloor = \frac{994}{2} = 497$.
-
Exponent of $3$: $$v_3(1000!) = 333 + 111 + 37 + 12 + 4 + 1 = 498.$$
Taking the minimum: $$k = \min(497, 498) = 497.$$ Therefore, $1000!$ ends in $497$ zeros in base $12$.
NityaDhi Solution (Intuitive Method)
Use Legendre's Base-$p$ Digit-Sum Identity $v_p(n!) = \frac{n - s_p(n)}{p-1}$, where $s_p(n)$ is the sum of base-$p$ digits of $n$:
- $1000 = 512 + 256 + 128 + 64 + 32 + 8 = 1111101000_2 \implies s_2(1000) = 6$, so $$v_2(1000!) = \frac{1000 - 6}{2 - 1} = 994 \implies \left\lfloor \frac{v_2}{2} \right\rfloor = 497.$$
- $1000 = 729 + 243 + 27 + 1 = 1101001_3 \implies s_3(1000) = 4$, so $$v_3(1000!) = \frac{1000 - 4}{3 - 1} = \frac{996}{2} = 498.$$ Hence $\min(497, 498) =$ $497$ in seconds, with zero long-division chains!
Common Mistakes to Avoid
- Assuming $v_3$ is always the bottleneck in base $12$: For most small $n$, $v_3(n!) < \lfloor v_2(n!)/2 \rfloor$ because $3 > 2$. However, asymptotically $\frac{v_2(n!)}{2} \approx \frac{n}{2}$ while $v_3(n!) \approx \frac{n}{2}$, so the digit sums $s_2(n)$ and $s_3(n)$ decide the winner! Here $s_2(1000) = 6 > 4 = s_3(1000)$ flips the bottleneck to $2^2$.