1.

Using the inclusion-exclusion principle, find the number of integers from a set of 1-100 that are not divisible by 2, 3 and 5.(a) 22(b) 25(c) 26(d) 33I got this question in unit test.My question is taken from Number Theory in portion Number Theory of Data Structures & Algorithms II

Answer»

The correct choice is (c) 26

Easiest explanation - Consider sample space S={1,…100}. Consider three subsets A, B, C that have ELEMENTS that are DIVISIBLE by 2, 3, 5 respectively. Find integers that are divisible by A and B, B and C, A and C. Then find the integers that are divisible by A, B, C. Applying the inclusion-exclusion principle, 100 − (50 + 33 + 20) + (16 + 10 + 6) − 3 = 26.



Discussion

No Comment Found

Related InterviewSolutions