Find last three nonzero digits of $1^1 \cdot 2^2 \cdot 3^3 \cdot ... \cdot 25^{25}$
Find the last three nonzero digits of $1^1 \cdot 2^2 \cdot 3^3 \cdot ... \cdot 25^{25}$.
I had been sitting with this problem whole day now, what I had tried so far:
Dividing the product by $10^{100}$ (since there are $5^{100}$ (taking fives from factors as well)). And playing with Chinese remainder theorem.
$1^1 \cdot 2^2 \cdot 3^3 \dots 25^{25} \equiv 0 \pmod{8}$
But I don't see any way apart from brute forcing the modulus $125$.
I had also noticed that the product can be rewritten as: $$ \frac{25!}{0!}\cdot \frac{25!}{1!} \cdot \frac{25!}{2!} \cdot \frac{25!}{3!} \cdot \cdot \cdot \frac{25!}{24!}$$ But I can't seem to get any useful information from that.
Here is a very crude approach that is doable by hand and with patience, but it isn't pretty:
The valuation of $n=1^1\cdot2^2\cdot\ldots\cdot25^{25}$ at each prime is $$v_p(n)=v_p\left(\prod_{k=1}^{25}k^k\right)=\sum_{k=1}^{25}v_p(k^k)=\sum_{k=1}^{25}v_p(k)\cdot k,$$ which is easily computed for larger primes, and is a bit more work for the smaller ones: \begin{eqnarray*} v_{23}(n)&=&1\cdot23=23,\\ v_{19}(n)&=&1\cdot19=19,\\ v_{17}(n)&=&1\cdot17=17,\\ v_{13}(n)&=&1\cdot13=13,\\ v_{11}(n)&=&1\cdot11+1\cdot22=33,\\ v_7(n)&=&1\cdot7+1\cdot14+1\cdot21=42,\\ v_5(n)&=&1\cdot5+1\cdot10+1\cdot15+1\cdot20+2\cdot25=100,\\ v_3(n)&=&1\cdot3+1\cdot6+2\cdot9+1\cdot12+1\cdot15+2\cdot18+1\cdot21+1\cdot24=135\\ v_2(n)&=&1\cdot2+2\cdot4+1\cdot6+3\cdot8+1\cdot10+2\cdot12+1\cdot14+4\cdot16\\ &\ &+1\cdot18+2\cdot20+1\cdot22+3\cdot24=304. \end{eqnarray*} This shows that $10^{100}$ divides $n$, but $10^{101}$ does not. So we want to find $0\leq k<1000$ such that $$10^{-100}n\equiv k\pmod{1000}.$$ It suffices to solve the congruence modulo $8$ and $125$ as we can then apply the Chinese remainder theorem. From $v_2(n)=304$ it is clear that $10^{-100}n\equiv0\pmod{8}$. Modulo $125$ we need to do some more work. Let's guess that $2$ is a primitive root modulo $125$. The identities $$2^7\equiv128\equiv3\pmod{125}\qquad\text{ and }\qquad 12^2\equiv144\equiv19\pmod{125},$$ already show that $3\equiv 2^7$ and $19\equiv 2^4\times3^2\equiv2^{18}$ modulo $125$. Similarly the identities $$9\cdot 19\equiv171\equiv46\equiv2\cdot23$$ $$6\cdot23\equiv138\equiv13$$ $$13^2\equiv169\equiv44\equiv4\cdot11$$ $$8\cdot17\equiv136\equiv11$$ $$11\cdot12\equiv132\equiv7,$$ show that $$23\equiv2^{31}\qquad13\equiv2^{39}\qquad11\equiv2^{76}\qquad17\equiv2^{73}\qquad7\equiv2^{85},$$ where all congruences are modulo $125$. Now we can rewrite the product $10^{-100}n$ in terms of powers of $2$, and simplify using Euler's theorem with $\varphi(125)=100$ to get \begin{eqnarray*} 10^{-100}n &\equiv&2^{304-100}3^{135}5^{100-100}7^{42}11^{33}13^{13}17^{17}19^{19}23^{23}\\ &\equiv&2^{204}2^{7\cdot135}2^02^{85\cdot42}2^{76\cdot33}2^{39\cdot13}2^{73\cdot17}2^{18\cdot19}2^{31\cdot23}\\ &\equiv&2^42^{45}2^{70}2^82^72^{41}2^{42}2^{13}\equiv2^{4+45+70+8+7+41+42+13}\\ &\equiv&2^{230}\equiv2^{30}\equiv2^{-1}\cdot23\equiv2^{-1}(23+125)\equiv74, \end{eqnarray*} where again all congruences are modulo $125$. Then by the Chinese remainder theorem we have $$10^{-100}n\equiv824\pmod{1000}.$$
So looking at what's left after the factors of $5$ and a matching number of $2$s are cleared (here from $10, 20$ and the powers of $2$): $$ R = 2^{48}\cdot3^{3+15}\cdot6^{6}\cdot7^{7}\cdot9^{9} \cdot11^{11}\cdot12^{12}\cdot13^{13}\cdot14^{14} \cdot17^{17}\cdot18^{18}\cdot19^{19} \cdot21^{21}\cdot22^{22} \cdot23^{23} \cdot24^{24} $$
and reducing to primes $$ R = 2^{204}\cdot3^{135}\cdot7^{42} \cdot11^{33}\cdot13^{13}\cdot17^{17}\cdot19^{19}\cdot23^{23}$$
For finding $R \bmod 1000$, we can cast out $100$'s since the multiplicative order of each prime mod 1000 must divide $100$, and since $7\times 11\times 13 = 1001$, we'll clean those up too.
$$(R\bmod 1000) \equiv 2^{4}\cdot3^{35}\cdot7^{29} \cdot11^{20}\cdot17^{17}\cdot19^{19}\cdot23^{23} $$
So basically there is still a lot of straight modular exponentiation to do. From each of the above factors:
$$(R\bmod 1000) \equiv 16\cdot 707\cdot 607\cdot 201\cdot 177\cdot 979\cdot 567 = 824$$
Plenty of room for error in that process, though, and no pretty shortcut.