# How many number of three digit numbers lying between 100 and 999 (inclusive) and having only two consecutive digits identical?

Please suggest a suitable approach for this problem.

• This is just counting isn't it? What's your motivation for this? Sep 24 '10 at 11:56
• This seems a bit like homework so here's just a hint: count the number that contain 00, 11, 22, ..., 99 (but not 111, 222, ...). Sep 24 '10 at 11:59
• Derek this is not a really a homework,the solution given is like this :9*9 + 1*9 + 8*9 = 162. But I am unable to figure out a proper explanation :| Sep 24 '10 at 12:02
• It helps to say something about the motivation behind the question, even if it is just homework, and also a little on what you've tried so far. Sep 24 '10 at 12:03
• Motivation is that it comes from my test paper.As the matter of fact I can only brute-force using computer programming to reach that answer,but I need some concrete idea to solve this problem logically. Sep 24 '10 at 12:09

Ok. Ask yourself first how many contain 00. Next, how many contain 11 (it's 17, you work it out). Then consider the number that contain 22, etc. You will get 9+17*9=162. I hope this helps.

• I understood your approach, which is like this :Number of numbers of the form 00 = 9, number of number of the form 11 = 9 and of the form *11 = 8 (we can't use 0 and 1 ) Thus we get 17 for 11 we will get 17 for each of 22,33,44,55,55,77,88,99.Hence the required answer is : 9+17*9 = 162. Sep 27 '10 at 9:26

In your comment, you said that the given solution was 9 • 9 + 1 • 9 + 8 • 9 = 162. I'll attempt to explain a logic that yields that calculation.

Consider the 3-digit numbers that start with two identical digits. There are 9 choices of the first digit (and inherently the second digit): 11, 22, 33, 44, 55, 66, 77, 88, and 99 (not 00 because the number is in the range 100-999). For each of these, there are 9 choices of the final digit (0-9, except whatever digit was already chosen for the first two). So, there are 9 • 9 such numbers.

Now, suppose that the number ends with two identical digits. There are 10 choices for the last digit (and inherently the second-to-last digit): 00, 11, 22, 33, 44, 55, 66, 77, 88, and 99, but we need to treat 00 separately from the rest. If the number ends with 00, then the first digit can be 1-9, so 9 choices, so 1 • 9. If the number ends with 11-99, there are 8 choices of first digit (1-9 except the digit already chosen), so 9 • 8.

While I have the 8 and 9 transposed in the final term, this is term-by-term the same expression as in the solution you gave.

• Thanks for an excellent explanation. Sep 27 '10 at 9:33

Number of three digits with only one pair of consecutive digit= 171. Let’s consider abc the three digits number. We need a=b or b=c. We have 9 ways of choosing a;

We have two scenario for b,

b=a, we have only one choice. In this case we have 9 ways of choosing c since because we can choose any number except a.

b not = a, we have 9 ways of choosing b. In this case we have only one way of choosing c; it has to be b, for us to have at least two consecutive digits.

So the number of three digits with only one pair of consecutive digits can be formed two ways, hence it is (9*1*9) + (9*9*1) = 81+81 = 162.