• edited by
20,801 views
40 40 votes
The number of integers between $1$ and $500$ (both inclusive) that are divisible by $3$ or $5$ or $7$ is ____________ .

10 Answers

Best answer
57 57 votes
Here, we can apply the property of set. Let $D_n$ denote divisibility by $n,$ $D_{n_1,n_2}$ denote divisibility by both $n_1$ and $n_2$ and so on.

$N(D_3 \cup D_5 \cup D_7)=N(D_3)+N(D_5)+N(D_7) -N(D_{3,5})-N(D_{ 5,7})-N(D_{3,7})+N(D_{3,5,7})$
$\quad \quad =166+100+71-33-14-23+4$
$\quad \quad =271$
• edited by
98 98 votes

EASY way to solve using GATE interface CALCULATOR;

$P(3\cup5\cup7=P(3)+P(5)+P(7)-P(3\times5)-P(5\times7)-P(3\times7)+P(3\times7\times5)$

  • $P(3)=\frac{500}{3}=\lfloor166.66\rfloor=166$
  • $P(5)=\frac{500}{5}=100$
  • $P(7)=\frac{500}{7}=\lfloor71.42\rfloor=71$
  • $P(3\times5)=\frac{500}{15}=\lfloor33.33\rfloor=33$
  • $P(7\times5)=\frac{500}{35}=\lfloor14.28\rfloor=14$
  • $P(3\times7)=\frac{500}{21}=\lfloor23.8\rfloor=23$
  • $P(3\times5\times 7)=\frac{500}{105}=\lfloor4.76\rfloor=4$

$\therefore P(3\cup5\cup7)= 166+100+71-33-14-23+4 = 271$

• edited by
10 10 votes

| AUBUC |= | A | + | B |+| C | - | A ⋂ B | - | A ⋂ C | -| B ⋂ C | + | A ⋂ B ⋂ C |
166 + 100 + 71 - 33 - 14 -23 + 4  = 271

9 9 votes

Here ,we can find:

$|A| = \left \lfloor \frac{500}{3} \right \rfloor = 166$

$|B| = \left \lfloor \frac{500}{5} \right \rfloor = 100$

$|C| = \left \lfloor \frac{500}{7} \right \rfloor = 71$

$|A\cap B| = \left \lfloor \frac{500}{LCM(3,5)} \right \rfloor =\left \lfloor \frac{500}{15} \right \rfloor = 33 $

$|B\cap C|  = \left \lfloor \frac{500}{LCM(5,7)} \right \rfloor =\left \lfloor \frac{500}{35} \right \rfloor = 14 $

$|A\cap C| = \left \lfloor \frac{500}{LCM(3,7)} \right \rfloor =\left \lfloor \frac{500}{21} \right \rfloor = 23 $

$|A\cap B \cap C| = \left \lfloor \frac{500}{LCM(3,5,7)} \right \rfloor =\left \lfloor \frac{500}{105} \right \rfloor = 4 $

Now we,can Apply Principle of Inclusion - Exclusion:

$(|A| \cup |B| \cup |C|) = |A| + |B| + |C|- | A\cap B| - | B\cap C| - | A\cap C| + | A\cap B\cap C|$

 

Put the values:

$(|A| \cup |B| \cup |C|) = 166+100+71-33-14-23+4$

$(|A| \cup |B| \cup |C|) = 341-70$

$(|A| \cup |B| \cup |C|) = 271$

 Number 1 to 500 is not divisible by either 2,3 or 5:

${(|A| \cup |B| \cup |C|)}' = N(U) - (|A| \cup |B| \cup |C|)$

${(|A| \cup |B| \cup |C|)}' = 500-271$

${(|A| \cup |B| \cup |C|)}' =229$

So, the number of integers between $1$ and $500$ (both inclusive) that are divisible by $3$ or $5$ or $7$ is $:271$ 

4 4 votes
by applying the Principle of Inclusion and Exclusion. Note that all divisions are to be rounded down to the nearest integer.

N = [ 500/3 + 500/5 + 500/7 ] - [ 500/15 + 500/35+ 500/21 ] + [ 500/(105) ]

= 166+100+71 - (33+14+23) + 4 = 271

if the question is of divisible then ans is 271.

if the question is of not divisible then its

500-271=229
• edited by
Answer:
Position:
Show:

Related questions

89 89 votes
12 answers 12 answers
29.1k
29.1k views
Arjun asked Feb 14, 2017
29,085 views
A cache memory unit with capacity of $N$ words and block size of $B$ words is to be designed. If it is designed as a direct mapped cache, the length of the $\textsf{TAG}$...
77 77 votes
4 answers 4 answers
30.6k
30.6k views
Arjun asked Feb 14, 2017
30,599 views
Consider the expression $(a-1) * (((b+c)/3)+d)$. Let $X$ be the minimum number of registers required by an optimal code generation (without any register spill) algorithm ...
149 149 votes
12 answers 12 answers
62.3k
62.3k views
Arjun asked Feb 14, 2017
62,349 views
Consider a $2$-way set associative cache with $256$ blocks and uses $\text{LRU}$ replacement. Initially the cache is empty. Conflict misses are those misses which occur d...
69 69 votes
10 answers 10 answers
32.0k
32.0k views
khushtak asked Feb 14, 2017
31,972 views
Instruction execution in a processor is divided into $5$ stages, Instruction Fetch (IF), Instruction Decode (ID), Operand fetch (OF), Execute (EX), and Write Back (WB). T...