# Numbers less than a million containing the digit 2.

• Apr 27th 2009, 10:57 AM
Mohron
Numbers less than a million containing the digit 2.
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
• Apr 27th 2009, 11:44 AM
Plato
Quote:

Originally Posted by Mohron
The question is, how many numbers less than 1,000,000 contain the digit 2?

There are $\displaystyle 9^6 - 1$ positive integers less than 1,000,000 that do not contain the digit 2.
So how many do?
• Apr 27th 2009, 12:07 PM
Mohron
Quote:

Originally Posted by Plato
There are $\displaystyle 9^6 - 1$ positive integers less than 1,000,000 that do not contain the digit 2.
So how many do?

OK, so 468,560? How do you know there are (9^6) - 1 positive integers that don't contain 2? Like any chance you have work to show?
• Apr 27th 2009, 12:14 PM
Plato
Quote:

Originally Posted by Mohron
OK, so 468,560? How do you know there are (9^6) - 1 positive integers that don't contain 2? Like any chance you have work to show?

Actually it is 468,559. 000000 is not a positive integer.
There are six places that can be filled with nine non-2 digits.
But we don't count 000000.
• Apr 27th 2009, 12:21 PM
Soroban
Hello, Mohron!

Sorry, your approach has a lot of duplication . . .

Quote:

How many numbers less than 1,000,000 contain the digit 2?
I am including 6-digit numbers with leading zeros.
After all, the number $\displaystyle 003279$ can represent the number $\displaystyle 3279.$

I solved it two ways:
. . [1] counting the numbers containg a 2
. . [2] counting the numbers without a 2 and subtracting from 999,999.

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: .$\displaystyle 9^5$ ways.
. . There are: .$\displaystyle 6\cdot9^5 \:=\:{\color{blue}354,\!294}$ numbers with one 2.

Numbers with exactly two 2's:
There are $\displaystyle {6\choose2} = 15$ positions for the two 2's.
The other four digits have 9 choices each: .$\displaystyle 9^4$ ways.
. . There are: .$\displaystyle 15\cdot9^4 \:=\:{\color{blue}98,\!415}$ numbers with two 2's.

Numbers with exactly three 2's:
There are $\displaystyle {6\choose3} = 20$ positions for the three 2's.
The other three digits have 9 choices each: .$\displaystyle 9^3$ ways.
. . There are: .$\displaystyle 20\cdot9^3 \:=\:{\color{blue}14,\!580}$ numbers with three 2's.

Numbers with exactly four 2's:
There are $\displaystyle {6\choose4} = 15$ positions for the four 2's.
The other two digits have 9 choices each: .$\displaystyle 9^2$ ways.
. . There are: .$\displaystyle 15\cdot9^2 \:=\:{\color{blue}1,\!215}$ numbers with four 2's.

Numbers with exactly five 2's:
There are $\displaystyle {6\choose5} = 6$ positions for the five 2's.
The other digit has 9 choices: .$\displaystyle 9$ ways.
. . There are: .$\displaystyle 6\cdot9 \:=\:{\color{blue}54}$ 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:

. . $\displaystyle 354,\!294 + 98,\!1415 + 14,\!580 + 1,\!215 + 59 + 1 \;=\;\boxed{468,\!559}$

• Apr 27th 2009, 12:22 PM
Mohron
Quote:

Originally Posted by Plato
Actually it is 468,559. 000000 is not a positive integer.
There are six places that can be filled with nine non-2 digits.
But we don't count 000000.

(9^6) = 531,441
(9^6) - 1 = 531,440

1,000,000 - 531,440 = 468,560

So it is not 468,559 correct? I took into account the (- 1)

Thanks for the help by the way. Greatly appreciated!
• Apr 27th 2009, 12:31 PM
Plato
Quote:

Originally Posted by Mohron
(9^6) = 531,441
1,000,000 - 531,440 = 468,560

There are only 999,999 positive integers less than 1,000,000.