The question is, how many numbers less than 1,000,000 contain the digit 2?
I am getting 600,000. It's too much to type out but I'm using this format.
1 10 10 10 10 10 = 100,000
10 1 10 10 10 10 = ""
10 10 1 10 10 10 = ""
10 10 10 1 10 10 = ""
10 10 10 10 1 10 = ""
10 10 10 10 10 1 = ""
= 600,000
Hello, Mohron!
Sorry, your approach has a lot of duplication . . .
I am including 6-digit numbers with leading zeros.How many numbers less than 1,000,000 contain the digit 2?
After all, the number can represent the number
I solved it two ways:
. . [1] counting the numbers containg a 2
. . [2] counting the numbers without a 2 and subtracting from 999,999.
And my answers agreed!
I'll do it head-on (Method 1) . . .
Numbers with exactly one 2:
There are 6 positions for the 2.
The other five digits have 9 choices each: . ways.
. . There are: . numbers with one 2.
Numbers with exactly two 2's:
There are positions for the two 2's.
The other four digits have 9 choices each: . ways.
. . There are: . numbers with two 2's.
Numbers with exactly three 2's:
There are positions for the three 2's.
The other three digits have 9 choices each: . ways.
. . There are: . numbers with three 2's.
Numbers with exactly four 2's:
There are positions for the four 2's.
The other two digits have 9 choices each: . ways.
. . There are: . numbers with four 2's.
Numbers with exactly five 2's:
There are positions for the five 2's.
The other digit has 9 choices: . ways.
. . There are: . numbers with five 2's.
Numbers with exactly six 2's:
There is one number with six 2's (namely, 222,222).
Therefore, the number of 6-digit numbers that contain a 2 is:
. .