How many whole numbers between $100$ and $800$ contain the digit $2$

combinatoricscontest-mathnumber theorypermutationssolution-verification

I had a very strange doubt in this question while I was solving it. Now in order to solve first I calculated the three digit numbers which won't have $2$ at all in them and the number of such three digit numbers between $100$ and $800$ will be $=6 \times 9 \times 9 = 486$.

Now as per the question we do no have to include $100$ and $800$ while counting so the total number of numbers between $100$ and $800$ will be $699$ and hence the number of whole numbers which will have $2$ in it should be $699 – 486=213$.

But let's say you have included $100$ and $800$ too then this will give the total number of numbers between $100$ and $800$ (both inclusive) will be 701 and hence the number of whole numbers which will have $2$ in it should be $701- 486=215$.

And when you include only $100$ or $800$ any one of them then the total number of numbers between $100$ and $800$ (any one of them is inclusive) will be 700 and hence the number of whole numbers which will have $2$ in it should be $700- 486=214$.

Now I am getting confused as to which one of them is the correct answer. Am I doing any silly mistake here? Please help me on this !!!

Thanks in advance !!!

Best Answer

When you count the number of three digit numbers that won't have a 2 in it, you're implicitly including 100, but not 800.

The way you count them (if I understand correctly), is that you have 6 choices for the first digit (1, 3, 4, 5, 6, 7), and then 9 choices for the second and third digit (1, 3, 4, 5, 6, 7, 8, 9, 0). So the two number 100 is a possibility here, but not 800.

So to get the right number in the end, you will have to include 100 but exclude 800.

Does that help?