# Number of 4-digit numbers that satisfies two conditions

Here is an exercise I could not solve:

A = Number of 4-digit numbers, which do not have two equal consecutive digits.

B = Number of 4-digit numbers, which do not have two equal digits.

How much is A - B?

I translated the exercise, so it may sound a litter weird to you. Here is what I have done:

If I understood the condition for B correctly, only the 4-digit numbers that do not have repeated digits satisfy the condition, so $B = 9\times9\times8\times7$.

A includes B but also numbers that do have repeated numbers, just not one next to the other, something like $abca$ $abac$ $baca$, so $A = B + 9\times9\times8\times3$.

Which would mean $A-B = 9\times9\times8\times3$, which is incorrect because does not correspond to any of the four options for the answer.

I apologize in advance for any dumb errors. I have always done terribly at combinatorics.

• The first digit must be 1-9 and cannot be zero. Consider A: there are 9 possible digits, 1-9, whatever digit you choose for the 2nd, it cannot be the one you chose for the 1st, so there are 9 digits (because there are 8 plus it can now be zero), there are 9 possible digits for the 3rd (because it can be anything but the previous--including 0), and 9, again, for the 4th. For B: again there are 9 possible digits for the 1st, then 9 again for the second (again 8 of 1-9 plus zero), then 8 for the 3rd (you've eliminated 2 of 10 possible digits), and finally 7 for the 4th. – Jared Feb 19 '16 at 5:14
• Since you are going to subtract A from B anyway, don't try to calculate A around B. That's just too hard. A. There are 9 choice for the first digit,9 for the second etc. So A is 9^4. B is 9x9x8x7. So A - B = 9x9x (81-56) – fleablood Feb 19 '16 at 6:40

A: you can have 9 digits for the first digit. (Anything but zero) You have 9 choices for the second digit (anything but the first digit). You have 9 for the third (anything but the second) and nine four the 4th (anything but the 3rd.)

So A =$9^4$.

B)no repeats. 9 for the first (anything but 0). 9 for the second (anything but the first). 8 for the 3rd (anything but the first and second). And 7 for the 3rd.

So B = $9*9*8*7$

A-B = $9*9*(81-56)=81*25=2025$