GateAI
Combinatorics

GATE CSE 2017 Set 1 · Q47

NAT2 marksMedium

Time

The number of integers between 1 and 500 (both inclusive) that are divisible by 3 or 5 or 7 is ________.

Your answerNumerical answer

Enter a value to check

Solution

Step-by-step verified solution

Official answer: 271 (±0)

Combinatorics

Let U={1,2,…,500}U = \{1, 2, \dots, 500\}, so ∣U∣=500|U| = 500.

Let:

  • AA be the set of integers divisible by 3

  • BB be the set of integers divisible by 5

  • CC be the set of integers divisible by 7

Using the Principle of Inclusion-Exclusion (PIE):

∣A∪B∪C∣=∣A∣+∣B∣+∣C∣−(∣A∩B∣+∣B∩C∣+∣C∩A∣)+∣A∩B∩C∣|A \cup B \cup C| = |A| + |B| + |C| - (|A \cap B| + |B \cap C| + |C \cap A|) + |A \cap B \cap C|

Calculating individual cardinalities:

  • ∣A∣=⌊5003⌋=166|A| = \lfloor \frac{500}{3} \rfloor = 166

  • ∣B∣=⌊5005⌋=100|B| = \lfloor \frac{500}{5} \rfloor = 100

  • ∣C∣=⌊5007⌋=71|C| = \lfloor \frac{500}{7} \rfloor = 71

Calculating pairwise intersections:

  • ∣A∩B∣=⌊500lcm(3,5)⌋=⌊50015⌋=33|A \cap B| = \lfloor \frac{500}{\text{lcm}(3, 5)} \rfloor = \lfloor \frac{500}{15} \rfloor = 33

  • ∣B∩C∣=⌊500lcm(5,7)⌋=⌊50035⌋=14|B \cap C| = \lfloor \frac{500}{\text{lcm}(5, 7)} \rfloor = \lfloor \frac{500}{35} \rfloor = 14

  • ∣C∩A∣=⌊500lcm(7,3)⌋=⌊50021⌋=23|C \cap A| = \lfloor \frac{500}{\text{lcm}(7, 3)} \rfloor = \lfloor \frac{500}{21} \rfloor = 23

Calculating three-way intersection:

  • ∣A∩B∩C∣=⌊500lcm(3,5,7)⌋=⌊500105⌋=4|A \cap B \cap C| = \lfloor \frac{500}{\text{lcm}(3, 5, 7)} \rfloor = \lfloor \frac{500}{105} \rfloor = 4

Applying PIE:

∣A∪B∪C∣=(166+100+71)−(33+14+23)+4|A \cup B \cup C| = (166 + 100 + 71) - (33 + 14 + 23) + 4
∣A∪B∪C∣=337−70+4=271|A \cup B \cup C| = 337 - 70 + 4 = 271

Thus, the answer is 271 [cite: 2].

Try the question first, then check your work.

Think the official key or this write-up is wrong?

Report error or challenge

Examiner trap

The misconception this question tests

This Combinatorics previous year question is Q47 of the GATE CSE 2017 Set 1 paper. Find more GATE CSE PYQs on Combinatorics in Engineering Mathematics, or browse all GATE CSE PYQs.

Free diagnostic

Where do you stand for GATE?

Take the 20-minute diagnostic: the 3 topics that cost you the most marks, and a rank range. Or sit 5 related Combinatorics PYQs now with no account.

One GATE CSE PYQ every morning

An official question by email at 7 AM IST, with a link to its verified solution. Unsubscribe in one click.

Combinatorics in GATE CSE

Combinatorics has 19 GATE CSE PYQs across 15 papers from 2012 to 2025. 7 of them are 2-mark NAT questions like this one, and it is the only one in GATE CSE 2017 Set 1.

How GATE tests Combinatorics

More from GATE CSE 2017 Set 1

Share this solution

A plain-text card for WhatsApp or Telegram study groups.

GateAI solution cardGATE CSE 2017 Set 1 · Q47 · NAT

The number of integers between 1 and 500 (both inclusive) that are divisible by 3 or 5 or 7 is …

Topic-wise GATE CS PYQs with verified steps

Independent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.