# Number of such five digit numbers formed of $0,1,2,3,4,5$ which are divisible by $6$ without repetition

I came across the question in the picture on the net. I couldn't figure out the solution given. But what I got is total number of such $5$ digit numbers using the given digits will be $5.5!$. Half of them will be divisible by $2$. And $1/3$ of them will be divisible by $3$. (Not sure though) What's next? I couldn't decipher what's written after that...

Please try to use the permutations and combinations approach if possible:

A $5$-digit number is formed by using the digits $0$, $1$, $2$, $3$, $4$ & $5$ without repetition. The probability that the number is divisible by $6$ is:

(A) $8\%$

(B) $17\%$

(C) $18\%$

(D) $36\%$

Ans: (C)

Hint: Number should be divisible by $2$ and $3$.

$n(S) = 5 \cdot 5!$; $n(A)$: reject '$0$' $= 2 \cdot 4!$

reject '$3$' $= 4! + 2 \cdot 3 \cdot 3!$

Total $n(A) = 3 \cdot 4! + 6 \cdot 3! = 18 \cdot 3!$

$\therefore p = \frac{18 \cdot 3!}{5 \cdot 5!} = 18\%$

We try to count how many five-digit numbers formed with digits $0,1,2,3,4,5$ are divisible by six.

To begin, we note three important facts:

• To be a five-digit number, the first digit must not be a zero (otherwise it would technically be a four-digit number. $01234$ is a four digit number)
• To be divisible by six, the number must be divisible by two, so the final digit must be either $0,2,$ or $4$
• To be divisible by six, the number must be divisible by three, so the sum of the digits must add up to a multiple of three. The only way for this to occur with the desired digits and no repetition of digits is if exactly one of $0$ or $3$ is used. (the proof of which follows from modular arithmetic)

So, putting this information together, we start counting.

Case 1: $0$ is not used

• Pick the final digit: It can either be a two or a four. - $2$ choices
• Pick how the rest of the digits are arranged. - $4!$ choices

Case 2a: $3$ is not used and $0$ is at the end

• Pick how the rest of the digits are arranged. - $4!$ choices

Case 2b: $3$ is not used and $0$ is not at the end

• Pick the final digit: It can be either a two or a four. -$2$ choices
• Pick the location of the zero. It cannot be at the start or the end. $3$ choices
• Pick how the rest of the digits are arranged. $3!$ choices

There are then a total of $2\cdot 4!+4!+2\cdot 3\cdot 3! = 108$ possible five-digit numbers satisfying the conditions.

The total number of five-digit numbers that can be created with those available digits will be $5\cdot 5!=600$. (Arrange all six digits in a row, the final digit is unused. Remove the "bad" arrangements where zero is the leading digit for $6!-5! = 5\cdot 5!$)

The probability that a five-digit number formed from those digits is divisible by six is then $\frac{108}{600}=0.18$

I. A number $n$ is divisible by $6$ if it is divisible by both $2$ and $3$.

II. A number $n$ is divisible by $2$ if the rightmost digit is even.

III. A number $n$ is divisible by $3$ if the sum of its digits is divisible by $3$.

We have access to six digits, $\{0,1,2,3,4,5\}$, which sum to $15$. We need a $5$-digit number. This means we must remove one digit such that the resulting digit-sum is divisible by $3$.

We can do this by either eliminating the $0$ (which results in the digit-sum $15$) or eliminating the $3$ (which results in the digit-sum $12$). This will allow us to create numbers that are divisible by $3$ no matter how we order the digits.

Your picture/solution is counting up the possible even numbers for both cases after the divisibility-by-$3$ rule has been satisfied by rejecting a particular digit from the set.