How many five digits numbers divisible by 3 can be formed
using the digits 0, 1, 2, 3, 4, 7 and 8 if each digits is
to be used at most once.
The sum of the digits must be a multiple of 3.
The smallest possible sum of 5 of those digits which
is a multiple of 3 is 15 which can be made in two ways:
0+1+2+4+8 = 15 and 0+1+3+4+7 = 15
The next possible sum of 5 of those digits which
is a multiple of 3 is 18 which can be made in two ways:
0+1+2+7+8 = 18 and 1+2+3+4+8 = 18
The next possible sum of 5 of those digits which
is a multiple of 3 is 21 which can be made in two ways:
0+2+4+7+8 = 21 and 1+2+3+7+8 = 21
The largest possible sum of 5 of those digits which
is a multiple of 3 is 24 which can be made in only one way:
2+3+4+7+8 = 24.
Since 0 cannot come first in a 5-digit number we have 2
cases, when 0 is one of the digits and when it is not.
Case 1: 0 is one of the digits. (0 cannot come first)
Digits are 0,1,2,4,8
Digits are 0,1,3,4,7
Digits are 0,1,2,7,8
Digits are 0,2,4,7,8
For each of those 4 combinations of digits:
We can choose the 1st digit any of 4 digits. (can't be 0)
We can choose the 2nd digit any of the remaining 4 digits. (can be 0)
We can choose the 3rd digit any of the remaining 3 digits.
We can choose the 4th digit either of the remaining 2 digits.
We can only choose the 5th as the 1 remaining digit.
That's 4*(4*4*3*2*1) = 384 ways for case 1
--------------------------------------------------------------
Case 2: 0 is not included.
Digits are 1,2,3,4,8
Digits are 1,2,3,7,8
Digits are 2,3,4,7,8
For each of those 3 ways,
We can choose the 1st digit as any of 5 digits.
We can choose the 2nd digit as any of the remaining 4 digits.
We can choose the 3rd digit as any of the remaining 3 digits.
We can choose the 4th digit as either of the remaining 2 digits.
We can only choose the 5th as the 1 remaining digit.
That's 3*(5*4*3*2*1) = 360 ways for case 2.
----------------------------------------------
Grand total for the two cases = 384+360 = 744.
Edwin