# Total number of 6 digit numbers possible.

The total number of natural numbers of 6 digits that can be formed with the digits 1,2,3,4, if all the digits are to appear in the same number atleast once is ?

As we want all these numbers to appear in the natural number, we first put these 4 digits into any 4 of the 6 places and arrange them in 6P4 ways.

Now remaining 2 places can be filled with any of the 4 numbers in 4*4 ways.

So total number of ways is 6P4 * 4*4.

Where am I going wrong ?

• @ShakedBader 6P4 means 6C4*4! Which includes choosing and multiplying. – Zephyr Nov 22 '17 at 20:40
• You are overcounting. For example, $112344$ gets counted four times, once for each position of a $1$ being among the first four digits times once for each position of a $4$ being among the first four digits. It is probably easier to count all the six digit numbers with these digits and subtract off the ones that don't have all the digits. You will need the inclusion-exclusion principle to do that. There are many examples on the site. – Ross Millikan Nov 22 '17 at 20:41
• @ShakedBader I think it will be more complicated. See 123432 it wil be counted at least two times. – hemu Nov 22 '17 at 20:43
• Inclusion Exclusion is a good way to proceed. Compute the number with no restrictions, then subtract those missing a specified digit, then add back those missing a specified pair, and so on. – lulu Nov 22 '17 at 20:52

A simple solution without using inclusion-exclusion is as follows.

First consider the six digits that are to be used irrespective of order.

4 possibilities are of the form A,A,A,B,C,D. The As can be positioned in $6C3=20$ ways and then the other digits can be positioned in 3! ways.

6 possibilities are of the form AABBCD. The As can be positioned in $6C2=15$ ways, then the Bs can be positioned in $4C2=6$ ways and then the other digits can be positioned in 2! ways.

The total is $$4.20.6+6.15.6.2=1560$$

for this question you can actually do the counting such that:

ABCDAA = 6!/3!  [comment: I divide by 3! because there are 3 As)
ABCDBB = 6!/3!
ABCDCC = 6!/3!
ABCDDD = 6!/3!


&

ABCDAB = 6!/(2!*2!) [comment: I divide by 2!*2! because there are 2 As and 2Bs)
ABCDAC = 6!/(2!*2!)