Two Be or Not Two Be...

Out of the numbers 0 to 9,999,999 exactly how many numbers contain at least one appearance of the digit 2 ?


The answer is 5217031.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

2 solutions

Satyen Nabar
Jul 2, 2014

A number that does not contain 2 is written using any of the other 9 digits: 0, 1, 3, 4, 5, 6, 7, 8, and 9.

So there are 9 choices for the first digit, then 9 choices for the second digit, and so on for each of the 7 digits. Therefore, there are 9x9x9…x9 = 9^7 = 4,782,969 numbers that do not contain the digit 2.

The remaining 10,000,000 – 4,782,969 = 5,217,031 are numbers that have at least one appearance of the digit 2.

The numbers with the digit 2 are more common!

@satyen nabar Note that 0 cannot be the first digit of a number, (except in the case of the number 0). Also, I believe that we need to look at the cases of 1-digit numbers, 2-digit numbers, etc., separately. With that in mind, I offered my solution to your problem. It is a bit of a surprise that numbers with at least one appearance of the digit 2 are more common! :)

Brian Charlesworth - 6 years, 11 months ago

Log in to reply

I don't think that it would matter because 10 to the power 7 refers to all the possibilities where the digits could have a value of 0 to 10 and 9 to the power of 7 also refers to all the possibilities where the 7 digits of the number could have a value of 0 to 10 leaving 2. Therefore, subtracting 10 to the power 7 from 9 to the power 7 would leave us with all the possibilities of numbers that contain at least one appearance of the digit 2.

Saksham Bansal - 6 years, 10 months ago

dammit, I calculated how many numbers from 0 to 9,999,999 contain at least one digit 2 and have digits that don't repeat... :/ the answer to that question apparently is 481,203 out of 713,539 if I got it right, which is about 67.44 %. Hence the numbers with non-repeating digits and the digit 2 are more common too among the non-repeating-digit numbers.

mathh mathh - 6 years, 11 months ago

The solution will be 10,000,000 minus the number of numbers between 0 and 9,999,999 (inclusive) that do not contain the digit 2.

To count the numbers that do not contain a 2, proceed as follows. Except for the number 0, we can't have 0 as the first digit. That leaves us with just 8 digits that can come first. There are then 9 options for each subsequent digit. So excluding the number 0 for now, we have 8 1-digit numbers, 8 * 9 2 -digit numbers, 8 * 9 2 9^{2} 3-digit numbers, etc., all the way up to 8 * 9 6 9^{6} 7-digit numbers.

So, including the number 0, we have

1 + 8 * k = 0 6 \sum_{k=0}^6 ( 9 k 9^k ) = 1 + [8 * ( 9 7 1 ) / ( 9 1 ) ({9}^7 - 1) / (9 - 1) ] = 9 7 9^7

numbers that can be formed without the digit 2.

So the solution will be 10 , 000 , 000 10,000,000 - 9 7 9^{7} = 5217031 \boxed{5217031} .

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...