# What is the number of 5 digit numbers divisible by 3? [closed]

What is the number of $5$ digit numbers divisible by $3$ using the digits $0,1,2,3,4,6,7$ and repetition is not allowed?

• Hint: the sum of the digits must be divisible by 3.
– Remy
Nov 16 '17 at 5:57
• Can the first digit be $0$? Nov 16 '17 at 7:02

the rule of three says that a number is divisible by three the sum of the digits is divisible by three. SO if one five digit number is divisible by three then any arrangement of its digits is divisible by three.

So it's a matter of finding the ways of picking $5$ out of $7$ numbers that add to a multiple of $3$ and multiplying by the number of ways we can arrange $5$ digits.

If $0$ is among the $5$ the number can't start with $0$ so there are four choice for the fist digit and $4!$ for the rest so $4*4!$ total. If $0$ is not among the $5$ there are $5!$ ways or arranging them.

Picking $5$ numbers that add to a multiple of three is a matter of picking the $2$ that we don't need. $0+1+2 +3+4+6+7= 23\equiv 2 \mod 3$ so this is matter of picking two numbers that add to $2 \mod 3$ (so the remaining $5$ will add to $0 \mod 3$. That is to say, $2$ that add to $2,5, 8,$ or $11$.

So those pairs are $(0,2),(1,4)(2,3),(1,7),(2,6),(4,7)$.

Of the sets of five remaining, $(1,3,4,6,7), (0,2,3,6,7), etc.$ only one has no $0$; $(1,3,4,6,7)$ and $5!$ ways to arrange them. The remaining $5$ have $0$s and so $4*4!$ ways to arange them. So there are $5*(4*4!) + 5! = 4*5! +5! = 5*5! = 5*120 = 600$ possible numbers.

If I'm not mistaken, the only ways $5$ of these digits can add up to a multiple of $3$ are:

$01236, 02367, 01467, 13467, 02346, 01347$

$5$ of these include a $0$. In which case, there are only $5!-4!$ ways to arrange these digits, since we cannot have the number start with a $0$. Otherwise it would be a $4$-digit number. In the case where there is no $0$, there are $5!$ ways to arrange its digits. All together,

$$5(5!-4!)+5!=600$$

• I got to my answer through trial and error. The others have better methods for the general case.
– Remy
Nov 16 '17 at 7:24

I mostly agree with the previous answer. You can add up all seven numbers in that set which is equal $23$. For a five digit number to be divisible by $3$ the sum of its digits has to be a multiple of three.

So we have to find all possible combinations of $5$ digit numbers that when all digits are added equals a multiple of $3$.

The sum of the $7$ numbers equals $23$ and we have to subtract $23$ by two numbers from the set to get the sum of five numbers. $23 - a - b$

Where $a+b$ has to equal a multiple of $3 +2$. e.g. $3n+2$. So like $5$ or $8$. Because $23 - (3n+2) = 21 - 3n$ which is divisible by $3$ meaning the five digit number is divisible by $3$.

So we find all possible pairs that equals a multiple of $3 + 2$

$(0,2) (1,4) (1,7) (2,3) (2,6) (4,7)$

Which is similar to the previous answer except there are more pairs. There are $5!$ or 120 ways to order $5$ digits so the answer is $6×120=720$

This is true assuming that $02367$ is considered to be a $5$ digit number. It might not be considered a $5$ digit number since it starts with zero. Otherwise the answer would be $720 - 5×4! = 600$