Find the number of 7-digit (base-10) numbers, such that each of the digits 1,2,3,4,5 must appear in the number (once or more).
Clearly, no leading zeros.
All the numbers must have at least one of each of 1, 2, 3, 4, and 5.
To make 7 digits altogether, two more must be added, possibly duplicating one or two of the five originals.
Possibilities:
00
01, 02, 03, 04, 05
06, 07, 08, 09
11
12, 13, 14, 15
16, 17, 18, 19
22
23, 24, 25
26, 27, 28, 29
33
34, 35
36, 37, 38, 39
44
45
46, 47, 48, 49
55
56, 57, 58, 59
66
67, 68, 69
77
78, 79
88
89
These can be categorized in 8 ways:
Those containing 00:
1234500 can be arranged in 7!/2! ways, but 6! of them will begin with 0.
Start the count at 7!/2! - 6! = 1800
Those containing zero and an extra digit from 1 to 5:
Ex.: 1234501
That can be arranged in 7!/2! ways but 6!/2! begin with 0. But also, there are 5 such sets of digits.
Add to the count (7!/2! - 6!/2!) * 5 = 10800
Those containing zero and an extra digit from 6 to 9:
Ex.: 1234506
There are 7! ways of arranging these, but 6! begin with 0. And there are 4 sets like this.
Add to the count (7! - 6!) * 4 = 17280
Those containing two identical extra digits from 1 to 5:
Ex.: 1234511
There are 7!/3! ways, and there are 5 such sets.
Add to the count 7!/3! * 5 = 4200
Those containing two different extra digits drawn from 1 to 5:
Ex.: 1234512
There are 7!/4 ways and there are C(5,2) = 10 such sets
Add to the count 7!/4 * 10 = 12600
Those containing two identical extra digits from 6 to 9:
Ex.: 1234566
There are 7!/2! ways, and there are 4 such sets.
Add to the count 7!/2! * 4 = 10080
Those containing two different extra digits drawn from 6 to 9:
Ex.: 1234567
There are 7! ways and there are C(4,2) = 6 such sets.
Add to the count 7! * 6 = 30240
Those containing an extra digit from 1 to 5 and one from 4 to 9:
Ex.: 1234516
There are 7!/2! ways and there are 5*4 = 20 such sets.
Add to the count 7!/2! * 20 = 50400
The sum is 137400.
|
Posted by Charlie
on 2015-11-19 11:13:05 |