# How many $3$-digit numbers can be formed using the digits $2,3,4,5,6,8$ such that the number contains the digits $5$ and repetitions are allowed?

The solution I have is by counting the complement which gives an answer of $91$. But I think that it should be solved as follows- Let the $3$-digit number be denoted by $3$ boxes. We can put the digit $5$ in one of the three boxes and we can put fill remaining two boxes with $6$-digits. Hence answer is $6\cdot 6\cdot 3= 108$. Help!

• The second method multiply counts those with more than one five.
– lulu
Dec 31, 2017 at 13:01

There is a single number with three $5$, there are $3\times 5^2$ numbers with a single $5$, and $3\times 5$ numbers with two $5$. It makes $91$ numbers.

• +1 why the downvote ? Dec 31, 2017 at 13:23

Take all the possible numbers with $5$

then substract all the numbers without $5$

Result: $6^3-5^3=91$

• good one @Isham +1 Dec 31, 2017 at 13:59

You are overcounting. Do not include the permutations of $5$s among themselves. Hence, divide into cases and solve.

The number of ways in which 5 can be filled in the three places is $3$.

For one $5$:

$3\times 5\times 5= 75$ //No repetition problems here.

For two $5$s :

$\dbinom32 \times 5 = 15$

For all $5$s :

Clearly there's only 1 possibility: $555$.

Thus, the required answer is $75+15+1= 91$

Edit:

Numbers over-counted by you:

$1)255$

$2)552$

$3)525$

$4)355$

$5)553$

$6)535$

$7)455$

$8)554$

$9)545$

$10)655$

$11)556$

$12)565$

$13)855$

$14)558$

$15)585$

$16)555$

$17)555$

Hence,you get a difference of $108 -91= 17$ in your answer.

• Thank you! By the way if you can explicitly state what all combinations I overcounted, it would be more helpful. Jan 1, 2018 at 6:24
• @Combinatorics Edited. Jan 1, 2018 at 8:54

The total numbers that can be formed using these $6$ digits is $6^3$. We find the number of numbers in which there is no $5$. Therefore numbers without the digit $5$ is $5^3$. Therefore the numbers with at least one $5$ in the number is $6^3-5^3=91$ Hence answer is $91$

Or you can do it the other way using cases:

1) Number contains only one $5$ and all letters are different:

Number of such numbers = $^5C_2. 3!=60$

2) Numbers with only one $5$ and other letters alike:

Number of such numbers=$^5C_1.\frac {3!}{2!}=15$

3)Numbers with two $5's$ and one other number:

Number of such numbers=$^5C_1.\frac {3!}{2!}=15$

4)Numbers with three $5's= 1$

Hence the total number of numbers satisfying the given condition =$60+15+15+1=91$.