The Gateway to Computer Science Excellence
+16 votes
3.8k views
The number of integers between $1$ and $500$ (both inclusive) that are divisible by $3$ or $5$ or $7$ is ____________ .
in Set Theory & Algebra by Veteran (431k points)
edited by | 3.8k views
0
I guess It was divisible in the original question.
0
Please say it was divisible in the question,not "not divisible".
0
this question gave me shivering that i missed the word NOT!!!.. btw it iwas not in question and 271 should be answer
0
It was "divisible" or "not divisible" in original(GATE) question?
0
I think we, can apply the Principle of Inclusion and Exclusion and get the answer.

8 Answers

+23 votes
Best answer
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$
by Active (3.4k points)
edited by
+37 votes

EASY way to solve using GATE interface CALCULATOR;

P(3 U 5 U 7) = P(3) + P(5) + P(7) - P(3X5) - P(5X7)- P(3X7)+ P(3X5X7)

  • P(3) = 500/3 = 166.66 Take166
  • P(5) = 500/5 = 100
  • P(7) = 500/7 = 71.42 Take 71
  • P(3X5) = p(15) = 500/15 = 33.33 Take 33
  • P(7X5) = p(35) = 500/35 = 14.28 Take 14
  • P(3X7) = p(21) = 500/21 = 23.8  Take 23
  • P(3X5x7) = p(105 ) = 500/105 = 4.76  Take 4

Answer = 166+100+71-33-14-23+4 = 271

by Boss (33k points)
edited by
+2
Why have u taken 15 all the places u should correct it
+1
Hey Rishi... that was a typing mistake. Thank you for pointing out the bug..!! :)
+1
its ok shiva
+13 votes

solution

by Boss (42.5k points)
reshown by
+8 votes

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

by Boss (12.4k points)
+3 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
by Active (3.8k points)
edited by
+2
but here u need to take lowershield function also
0
In both ways ans is coming same....
+1 vote

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$ 

by Veteran (59.2k points)
0 votes
first no which are divisible by 3 = lwowershield(500/3)+lwowershield(500/5)+lwowershield(500/7)-lwowershield(500/3*5)-lwowershield(500/3*7)-lwowershield(500/5*7)+lwowershield(500/3*7*5)=result

 

now to find not divisible by = 500-result
by Active (5.1k points)
0 votes
Okay,Now in this question concept of the Inclusion-Exclusion  comes into play.how we are getting the formula?

simple formula

P(AUB)=P(a)+P(b)+P(c)-P(ab)-P(bc)-P(ca)+P(abc)

so

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

=271

so 271 should be correct answer
by Boss (18k points)
0
Why should I divide 500 or any number by 3 or 5 or anything to get how many numbers between 1 and 500 is divisible by 3 or 5.
Answer:

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,737 questions
57,366 answers
198,496 comments
105,265 users