Determine the number of positive integers less than 1000 that are divisible neither by 5 nor by 7.
Rough estimate: 1000-1000*(1/5 + 1/7 - 1/35)
or 1000*((4/5)*(6/7))
both of which are 1000*(24/35) = 685.714285
From 1 to 1000 exactly 20% are divisible by 5, so we are down to 800.
And 1/7 (i.e. 142) are divisible by 7.
800 - 142 = 658.
But we must add back all the multiples of 35 of which there are 28 which are < 1000
658 + 28 = 686
Brute force program confirms: 686
|
Posted by Larry
on 2025-04-22 12:22:38 |