Clearly, |S| = 50.
Count the multiples of 2 between 1 and 50:
⌊50/2⌋ = ⌊25⌋ = 25
(where ⌊x⌋ denotes the "floor of x", or the largest integer that is smaller than or equal to x; in other words, round down to the nearest integer)
Count the multiples of 3 between 1 and 50:
⌊50/3⌋ ≈ ⌊16.667⌋ = 16
Since LCM(2, 3) = 6, the sets of multiples of 2 and multiples of 3 have some overlap. Count the multiples of 6 between 1 and 50:
⌊50/6⌋ ≈ ⌊8.333⌋ = 8
Then by the inclusion/exclusion principle, we remove from S
25 + 16 - 8 = 33
elements, so that the new set S contains 50 - 33 = 17 elements.