What is the sum of all multiples of 2 and all multiples of 3 from 1 to 50, inclusive?
*NOTE: Be careful not to double count.
Answer is 842. Please explain it… I tried but could not find the exact answer
What is the sum of all multiples of 2 and all multiples of 3 from 1 to 50, inclusive?
*NOTE: Be careful not to double count.
Answer is 842. Please explain it… I tried but could not find the exact answer
Essentially when you are adding the sum of multiples of 2 and sum of multiples of 3, you are adding numbers like 6, 12,… which are included in both the first sum as well as the second one. So, you need to subtract the sum of common elements once to eliminate this double counting.
You can also solve this using venn diagram.