An expert question on inclusion–exclusion for P5–P6, with a step-by-step solution, diagrams and the answer. Common in the Hua Xia Cup's P3 to P6 qualifying rounds and finals; harder ones have three overlapping groups, or ask who is in exactly two.
The question
For Mid-Autumn, the harbourfront promenade has 2799 lamp posts numbered 1 to 2799.
Posts numbered with a multiple of 10 get a red lantern, multiples of 15 a yellow one, and multiples of 4 a blue one.
A post that fits several rules gets that many lanterns.
How many posts have exactly two lanterns?
Show the hints (3)
💡Hint 1: Being a multiple of both 10 and 15 means being a multiple of what? And the other two pairs?
💡Hint 2: Count the common multiples for each pair. A post that fits all three rules is counted once in each of those three counts.
💡Hint 3: 10 and 15: multiples of 30, 93; 15 and 4: of 60, 46; 10 and 4: of 20, 139; all three: of 60, 46.
Worked solution
Have a go first, then read the solution step by step.
1.Pairwise LCMs: 10 and 15 → 30; 15 and 4 → 60; 10 and 4 → 20. All three → 60.
2.From 1 to 2799: 93 multiples of 30, 46 of 60, 139 of 20, 46 of 60.
3.The 46 posts with three lanterns are counted once in each of 93, 46 and 139: three times, and all three must come off.
4.Exactly two: 93 + 46 + 139 − 3 × 46 = 140.
⚠️Common mistakes: using products like 10 × 15 instead of the LCM, or taking off the three-lantern posts only once.