<s>[INST] Using only the digits 2,3,9, how many six-digit numbers can be formed which are divisible by 6? 
Using only the digits $2,3,9$, how many six-digit numbers can be formed which are divisible by $6$?
The options are:
(A) $41$
(B) $80$
(C) $81$
(D) $161$

The last digit must be $2$. But I faced problem when calculating the number of number which are divisible by $3$. Somebody please help me.
 [/INST] Let's find a divisability test for 6.
\begin{equation}
1 = 1 \mod 6\\
10 = 4 \mod 6\\
100 = 4*10 = 4 \mod 6,\\
\text{and so on for higher powers of 10}
\end{equation}
Thus, we find: a number X is divisable by 6 iff, cutting of the last digit, taking the sum of the other digits times 4 and adding the last digit the result is divisable by 6.
You are asked for a 6 digit number using only $2,3,9$. We are thus asked to find $a,b,c,d,e,f \in {2, 3, 9}$ such that $4 * (a + b + c + d + e) + f = 0 \mod 6$. As you noted, the last digit must be $2$, which you can conclude from the equation above quite easily by noticing that f must be even. So we conclude $4 * (a + b + c + d + e) = 4 \mod 6$ thus $a + b + c + d + e = {1,4} \mod 6$ and $a + b + c + d + e = 1 \mod 3$ follows. Since both $6$ and $9$ reduce modulo 6, either 2 or 5 higher digits must be equal to $2$, the rest can be chosen freely.
\begin{equation}
\binom{5}{2} * 2^3 + \binom{5}{5} * 2^0 = 81
\end{equation}
</s>