How many numbers are divisible by?

96 Views Asked by At

How many numbers $1\leq n \leq 300$ are there which are:

  1. Divisible by at least one of $3$,$5$, or $7$
  2. Divisible by $5$ and $3$ but not $7$
  3. Divisible by $5$ but not by either of $ 3 $or $7$

My attempt,

  1. $T_i$ - Numbers $1\leq n \leq 300$ divisible by $i\in \mathbb{N} = \text{floor}(\frac{300}{i})$

So our required answer for 1. should be $T_3 + T_5 + T_7 -(T_3 \cap T_5 + T_3\cap T_7 + T_5\cap T_7) + T_3\cap T_5 \cap T_7 = T_3 + T_5 + T_7 - (T_{15} + T_{21} + T_{35}) + T_{105} = 100 + 60 + 42 - (20 + 14 + 8) + 2 = 162$

  1. Using the fact $|A\setminus B| = |A|- |A\cap B|$, our answer is: $ T_{15} - T_{105} = 20 -2=18$

  2. We have the case $|A\setminus(B\cup C)|$, so our answer should be:$|T_5| - |T_5\cap T_3| - |T_5\cap T_7| + |T_5\cap T_3 \cap T_7| = 60 -20 - 8 + 2 =34$

Are these logic and answers correct?

1

There are 1 best solutions below

0
On BEST ANSWER

Yes, you have used the Inclusion Exclusion principle correctly. Both logic and resullts are correct.