# Find the number of 5-digit number divisible by 6 which can be formed using $0,1,2,3,4,5$ if repetition of digits is not allowed.

Find the number of $$5$$-digit number divisible by $$6$$ which can be formed using $$0,1,2,3,4,5$$ if repetition of digits is not allowed.

I started by considering the following cases:

1. Unit digit = $$0$$ I can fill four places with digits $${1,2,4,5}$$ , so number of 5-digit numbers $$= P(4,4) = 24$$
2. Unit digit = $$2$$ I can fill four places with digits $${0,1,3,4,5}$$ such that (a) $$0$$ does not come in the first place (b) either of $$1,4$$ is used (c) $$0,3,5$$ are always used. I have to fill 4 places with $$0,(1,4),3,5$$. So, total number of arrangements $$=P(4,4)$$. Number of arrangements when $$0$$ comes as first digit $$=P(3,3)$$. Number of arrangements of $$(1,4) = 2$$. Therefore , number of 5-digit numbers $$=2(P(4,4)-P(3,3)) = 36$$
3. Unit digit = $$4$$ Similarly, number of 5-digit numbers $$= 36$$

Therefore, the total number of 5-digit numbers $$= 24+36+36 = 96$$.

But the correct answer is $$108$$. Where did I make a mistake?

• It is always 0 or 3 that is not used Jun 11, 2021 at 13:58

The number has to be divisible by $$3$$, so the sum of the digits must also have that property. Since the sum of the six digits is $$15$$, the missing digit has to be either $$0$$ or $$3$$. (This was your mistake -- you thought that either 1 or 4 needed to be unused).

• If the missing digit is $$0$$, then the units digit can be chosen in two ways and the remaining four digits can be arranged in $$4!=24$$ ways. This leads to $$2\cdot24=48$$ cases.
• If the missing digit is $$3$$ and $$0$$ is the units digit, then the remaining four digits can be arranged in $$4!=24$$ ways,
• If the missing digit is $$3$$ and $$0$$ is not the units digit, then the units digit can be chosen in two ways. From the remaking four digits, the ten-thousands digit can be chosen in three ways (to avoid a leading zero), and the remaining three digits can be arranged in $$3!=6$$ ways. This leads to $$2\cdot3\cdot6=36$$ cases.

The total is $$48+24+36=108$$ possible cases.

• very good $+1$ ! Jun 11, 2021 at 18:28

Case $$1$$: $$1,2,3,4,5$$ are chosen. For the number to be divisible by $$2$$, last digit is $$2$$ or $$4$$, i.e. last digit can be selected in 2 ways and the other digits can arrange in $$4!$$. Thus, the number of ways =$$4! \cdot 2=48$$.

Case $$2$$: $$0,1,2,4,5$$ are chosen. a) if last digit is $$0$$: number of ways =$$4!=24$$

b) if last digit is $$2$$: the other digits may be filled in (from left to right): $$3×3×2×1=18$$ ways.

c) if last digit is $$4$$: the other digits may be filled in (from left to right): $$3×3×2×1=18$$ ways. So, the answer $$=48+24+18+18=108$$ ways.

So answer is $$108$$.

– user876009
Jun 11, 2021 at 14:43

The sum of the digits must be divisible by $$3$$, so either $$0$$ or $$3$$ must be absent (since $$0+1+2+3+4+5=15$$ is divisible by $$3$$).

If $$0$$ is absent, then we have a permutation of $$12345$$ where the last digit is $$2$$ or $$4$$, giving $$(2)(4!)=(2)(24)=48$$ possibilities.

If $$3$$ is absent, then we have a permutation of $$01245$$ where the first digit is not $$0$$ and the last digit is $$0, 2,$$ or $$4$$. Such permutations could be counted as follows:

First, consider the case where the last digit is $$0$$. In this case, the remaining digits must form a permutation of $$1245$$, giving $$4!=24$$ possibilities.

Second, consider the case where the last digit is $$2$$ or $$4$$. In this case, the remaining digits must form a permutation of $$0145$$ (if the last digit is $$2$$) or $$0125$$ (if the last digit is $$4$$) where the first digit is not $$0$$. This gives $$(2)(4!-3!)=(2)(24-6)=(2)(18)=36$$ possibilities.

Thus, there are $$48+24+36=108$$ possible numbers.