The number of numbers greater than 5000, less than 9000 and divisible by 3, that can be formed using the digits 0, 1, 2, 5, 9, if the repetition of the digits is allowed, is
Answer
42
Solution
Such numbers have 4 digits; the first digit must be 5 (a first digit 9 gives a number 9000).
Remainders of the digits on division by 3:
\0, 9\ 0, \1\ 1, \2, 5\ 2
First digit 5 2, so the last three digits must have digit sum 1 3.
Remainder patterns of the last three digits with sum 1:
(0, 0, 1): 3 2 2 1 = 12
(1, 1, 2): 3 1 1 2 = 6
(0, 2, 2): 3 2 2 2 = 24
(the factor 3 places the odd one out; every other remainder pattern gives a digit sum 0 or 2)
required number = 12 + 6 + 24 = 42 (none of them equals 5000)
Answer: 42