how many pairs of integers Given two sets $A=\{1,2,3, \ldots, 50\}$ and $B=\{1,2,3,  \ldots, 60\}$. How many pairs of numbers $(a,b)$ with $a$ from $A$, $b$ from $B$ such that the product of $a,$ and $b$ is divisible by 6?
 A: Let us choose a number from set A and then see how many numbers we can choose from set B. 
If we choose a multiple of 6, there are 8 possible choices (6,12,...48). So from set B, we can choose any of the 60 numbers. 
Choices here = $8. 60 = 480$
Now say we choose a multiple of 2 from A. There are a total of 25, but since we already considered 8, so we are left with 17. For them, we need a multiple of 3 from set B. There are 20 possibilities for each. So, 
Choices here = $17. 20 = 340$
Now we choose a number from set A which is divisible by 3. There will similarly be $16-8=8$ cases, for which there are $30$ choices in set B. 
Choices here = $8. 30 = 240 $
Now there are $(50-8-17-8)=17$ unconsidered numbers from A. For each, you need a multiple of 6 from B and so there are exactly 10 choices. 
Choices here = $17.10 = 170$
Now we are done, so sum them up.
$480+340+240+170 = 1230$,  which is your answer. 
A: Let's use inclusion-exclusion to count these. There are $50\times 60$
pairs $(a,b)$ overall. Of these $25\times 30$ have both $(a,b)$ odd,
equivalently $2\nmid ab$, and $34\times 40$ have $3\nmid ab$. But we have to count
those pairs with $2\nmid ab$ and $3\nmid ab$ and there are $17\times 20$
of these. The answer is thus
$$50\times60-25\times30-34\times40+17\times20=1230.$$
