GATE / CS ARCHIVE

GATE CSE 2017 SET 1 / QUESTION 47

GATE CSE 2017 Set 1 Q47

Discrete Mathematics · Proof Techniques & Number Theory · Full GATE CSE 2017 Set 1 paper

GATE 2017 Set 1, Q47 2 marks · NAT
Report issue

Proof Techniques & Number Theory

Question 47, GATE 2017: How many integers from 1 through 500 inclusive are divisible by 3 or 5 or 7?
Tap to enlarge
Answer & solution

Official answer: 271.0

Our answer: 271

1. Count multiples separately: floor(500/3)=166, floor(500/5)=100, floor(500/7)=71. Their sum double-counts integers divisible by more than one divisor.

2. Subtract pairwise intersections using least common multiples 15,21,35: 33,23,14 respectively. Triple multiples of 105 were counted three times then subtracted three times, so restore floor(500/105)=4.

3. The union size is 166+100+71−33−23−14+4=271. Inclusive endpoints are handled by the floor counts.

Original paper, page 21 · Answer key