<s>[INST] How many factors of $2010^{2010}$ have last digit $2$? 
How many factors of  $2010^{2010}$ have last digit $2$?

It is not difficult to solve this using python/mathematica, but I want to know how to (smartly) solve this one with paper and pencil?
 [/INST] Since $2010=2\cdot3\cdot5\cdot67$, the factors of $2010^{2010}$ are all of the form $F=2^a\cdot3^b\cdot5^c\cdot67^d$ with $0\le a,b,c,d\le2010$. Since we want the last digit of $F$ to be $2$, we must have $a\ge1$ and $c=0$.


*

*The last digits of $2^a$ ($a\ge1$) are $2,4,8,6$, and they repeat
periodically.

*The last digits of $3^b$ ($b\ge0$) are $1,3,9,7$, and they repeat periodically.

*The last digits of $67^d$ ($d\ge0$) are $1,7,9,3$, and they repeat periodically.


Let $\alpha$ be the last digit of $2^a$, $\beta$ be the last digit of $3^b$ and $\delta$ be the last digit of $67^d$. For the last digit of $F=2^a\cdot3^b\cdot67^d$ to be $2$, the last digit of $\alpha\cdot\beta\cdot\delta$ must be also $2$. When does this happen? There are $16$ possibilities for the triple $\{\alpha,\beta,\delta\}$: $\{2,1,1\}$, $\{2,3,7\}$, $\{2,9,9\}$, $\{2,7,3\}$, $\{4,1,3\}$, $\{4,3,1\}$, $\{4,9,7\}$, $\{4,7,9\}$, $\{8,1,9\}$, $\{8,3,3\}$, $\{8,9,1\}$, $\{8,7,7\}$, $\{6,1,7\}$, $\{6,3,9\}$, $\{6,9,3\}$ and $\{6,7,1\}$. All we have to do is count how many factors there are with each of the $16$ possibilities. For instance, for $\{2,1,1\}$ we must have
$$
a\equiv 1 \mod4,\quad b\equiv0\mod4\quad\text{and}\quad  d\equiv0\mod 4.
$$
This gives $503$ possible values for each of $a$, $b$ and $c$, for a total of $503^3$ factors.
I'll leave it to you to do the computations for the other $15$ cases.
</s>