4. In the number $2016^{* * * *} 02 *$, each of the 5 asterisks needs to be replaced with any of the digits $0,2,4,6,7,8$ (digits can be repeated) so that the resulting 11-digit number is divisible by 6. In how many ways can this be done
Answer: 2160.

Solution. For a number to be divisible by 6, it is necessary and sufficient that it is divisible by 2 and by 3. To ensure divisibility by 2, we can choose the last digit from the available options as $0, 2, 4, 6, 8$ (5 ways).

To ensure divisibility by three, we proceed as follows. Choose three digits arbitrarily (this can be done in $6 \cdot 6 \cdot 6$ ways), and select the fourth digit so that the sum of all the digits of the number is divisible by 3. Since among the given digits there are two digits that are divisible by 3 (0 and 6), two digits that give a remainder of 1 when divided by 3 (4 and 7), and two digits that give a remainder of 2 when divided by 3 (2 and 8), this selection can be made in two ways.

Applying the rule of product, we get a total of $5 \cdot 6 \cdot 6 \cdot 6 \cdot 2 = 2160$ ways.