# Does anyone know why this inclusion exclusion calculation isn't working?

In this question, the problem is to find the amount of numbers that have the following characteristics:

All digits are unique.

Does not contain the digits 3 and/or 4.

The number is divisible by 3.

I was going to use inclusion/exclusion for this, which states:

$$N(A\cap{B})=N(A)+N(B)-N(A\cup{B})$$

Take $A$ to be the first two properties, and $B$ to be the third. It must be a $4$ digit number, and cannot contain $3$ or $4$:

$$7\cdot{7}\cdot{6}\cdot{5}$$

Now consider the number of $4$ digit numbers divisible by $3$. The amount of numbers divisible by $3$ between $1$ and $10000$ is $3333$. The amount of numbers divisible by $3$ between $1$ and $1000$ is $333$. Subtract one from the other, and the amount of numbers divisible by $3$ between $1000$ and $10000$ is $3000$.

$$N(A)=7\cdot7\cdot6\cdot5\\ N(B)=3000\\ N(A\cup{B})=9000$$

This comes out to a negative number, which tells me I'm setting up my cases incorrectly. Can anyone tell me what I'm doing wrong?

-
When you are counting numbers divisible by $3$, you are counting (i) those that have $3$ and/or $4$ and (ii) those with repeated digits. I think the problem you are trying to solve may be somewhat ugly. –  André Nicolas Aug 3 '13 at 5:45
How did you get $N(A\cup{B})=9000$? Obviously you can't have $N(A\cup{B}) > N(A) + N(B)$, so there's something very wrong with your calculation of $N(A\cup{B})$. But in fact I can't think of a way here to calculate $N(A\cup{B})$ without also calculating $N(A\cap{B})$. –  ShreevatsaR Aug 3 '13 at 5:47
@Shreevatsa I just took $N(A\cup{B})$ to be the total amount of 4 digit numbers, but I guess that's incorrect... –  Ataraxia Aug 3 '13 at 5:52
@Ataraxia: $A\cup{B}$ is the set of 4-digit numbers that either have all digits distinct and different from 3/4, or are divisible by 3 (or both). For instance, a number like 1337 is not in the set $A\cup{B}$, because it neither has distinct digits, nor is it divisible by 3 (i.e. it's neither in $A$ nor in $B$, so it's not in $A\cup{B}$). –  ShreevatsaR Aug 3 '13 at 6:08
This question is asking about why their inclusion/exclusion argument didn't work, it is not just asking for the solution. This shouldn't be marked as a duplicate. –  Jim Aug 7 '13 at 16:40
show 1 more comment