The whole numbers from $$1$$ to $$2016$$ inclusive are written on a blackboard. Moritz underlines all the multiples of two in red, all the multiples of three in blue and all the multiples of four in green. How many numbers does Moritz underline exactly twice? 
Overseas Competition->Knowledge Point->Number Theory Modules->Factors and Multiples->Basic Concepts of Factors and Multiples
There is no number that is both a multiple of three and a multiple of four without also being a multiple of two. Hence, the numbers underlined exactly twice are those that are a multiple of two and of three but not of four and those that are a multiple of two and four but not of three. The first set of numbers consists of the set of odd multiples of six. Since $$2016 \div 6 = 336$$, there are $$336$$ multiples of $$6$$ in the list of numbers and hence $$336 \div 2 = 168$$ odd multiples of six that would be underlined in red and blue but not green. The second set of numbers consists of two out of every three multiples of four and, since $$2016 \div 4 = 504$$, there are $$3\times 504 = 336 $$ numbers that would be underlined in red and green but not blue. Hence there are $$168+ 336 = 504$$ numbers that Moritz would underline exactly twice. 