31. How many natural numbers not exceeding 500 and not divisible by 2, 3, or 5 are there?
31. Let's calculate the number of numbers divisible by 2, or by 3, or by 5. 250 numbers are divisible by 2 (500: 2 = 250). 166 numbers are divisible by 3 (500: 3 = 166 (remainder 2)). At the same time, numbers divisible by both 2 and 3, i.e., by 6, are counted twice. There are 83 such numbers (500: 6 = 83 (remainder 2)). Therefore, the number of numbers divisible by 2 or 3 is 250 + 166 - 83 = 333. 100 numbers are divisible by 5 (500: 5 = 100). However, numbers divisible by both 5 and 2, i.e., by 10, are included here. There are 50 such numbers (300: 10 = 50). Since they are already included in the numbers divisible by 2, they need to be excluded here: 100 - 50 = 50. Among these numbers, those divisible by both 5 and 3, i.e., by 15, are included. There are 33 such numbers. They are already included in the numbers divisible by 3, so they need to be excluded here: 50 - 33 = 17. However, by excluding numbers divisible by both 2 and 5, as well as by 3 and 5, we have excluded numbers divisible by 2, 3, and 5, i.e., by 30, twice. There are 16 such numbers. Thus, the total number of numbers up to 500 that are divisible by 2, or by 3, or by 5, is 333 + 17 + 16 = 366, and therefore, the number of numbers not divisible by 2, 3, or 5 is 500 - 366 = 134.