The number of 5-digit numbers which are divisible by 3 that can be formed by using the digits 1,2,3,4,5,6,7,8 and 9, when repetition of digits is allowed, is
----------(5 blanks)
1st blank can be filled in 9 ways
2nd blank can be filled in 9 ways _______ since repetition is allowed.
3rd blank can be filled in 9 ways
4th blank can be filled in 9 ways
Now, we have to fill the 5th blank carefully such that the number is divisible by 3. Add the 4 numbers in the first 4 blanks.
If their sum is in the form 3n, then fill the last blank by 3, 6 or 9 so that the sum of all digits is divisible by 3.
If their sum is in the form 3n+1, than fill the last blank by 2, 5 or 8.
If their sum is in the form 3n+2, than fill the last blank by 1, 4 or 7.
Therefore, in any case, the last blank can be filled in 3 ways only.
∴ Ans =9×9×9×9×3=39.