Compute the number of positive integers less than or equal to that are divisible by or , but not both.
Problem 1192
Official solution
1. Count the numbers divisible by 5:
So, there are 403 numbers less than or equal to 2015 that are divisible by 5.
2. Count the numbers divisible by 13:
So, there are 155 numbers less than or equal to 2015 that are divisible by 13.
3. Count the numbers divisible by both 5 and 13 (i.e., divisible by their least common multiple, 65):
So, there are 31 numbers less than or equal to 2015 that are divisible by 65.
4. Apply the Principle of Inclusion and Exclusion (PIE):
The number of integers less than or equal to 2015 that are divisible by 5 or 13 is given by:
5. Count the numbers divisible by both 5 and 13 (i.e., divisible by 65) again to exclude them:
Since we need the numbers divisible by 5 or 13 but not both, we subtract the numbers divisible by 65 from the total: