求1到1000能同时被3 5 7整除的数的个数Use inclusion/exclusion principle to calculate how many numbers between 1 and 1000 are divisible by any of 3,5,7 可能是要求用交集并集来求(设A为能被3整除的数,B为能被5整除的数,

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/11 12:53:32
求1到1000能同时被3 5 7整除的数的个数Use inclusion/exclusion principle to calculate how many numbers between 1 and 1000 are divisible by any of 3,5,7 可能是要求用交集并集来求(设A为能被3整除的数,B为能被5整除的数,

求1到1000能同时被3 5 7整除的数的个数Use inclusion/exclusion principle to calculate how many numbers between 1 and 1000 are divisible by any of 3,5,7 可能是要求用交集并集来求(设A为能被3整除的数,B为能被5整除的数,
求1到1000能同时被3 5 7整除的数的个数
Use inclusion/exclusion principle to calculate how many numbers between 1 and 1000 are divisible by any of 3,5,7
可能是要求用交集并集来求(设A为能被3整除的数,B为能被5整除的数,C为能被7整除的数)

求1到1000能同时被3 5 7整除的数的个数Use inclusion/exclusion principle to calculate how many numbers between 1 and 1000 are divisible by any of 3,5,7 可能是要求用交集并集来求(设A为能被3整除的数,B为能被5整除的数,
必然是 3*5*7=105 的整数倍
105 210 315 ... 945 一共9个

能被3整除的数字共有:1000/3=333个
能被5整除的数字共有:1000/5=200个
能被7整除的数字共有:1000/7=142
能同时被7和5整除的数:1000/35=28
能同时被7和3整除的数:1000/21=47
能同时被5和3整除的数:1000/15=66
能同时被3、5、7整除的数有:1000/105=9
所以不能被3、5、...

全部展开

能被3整除的数字共有:1000/3=333个
能被5整除的数字共有:1000/5=200个
能被7整除的数字共有:1000/7=142
能同时被7和5整除的数:1000/35=28
能同时被7和3整除的数:1000/21=47
能同时被5和3整除的数:1000/15=66
能同时被3、5、7整除的数有:1000/105=9
所以不能被3、5、7任何一个数整除的数共有:1000-(333+200+142-28-47-66+2*9)=448个

收起

9,我用程序算出来的。

A∩B∩C
呵呵~~~
还有个方法~ 因为 3 5 7 互为质数 ,那么能被它整除的数 必须被 3*5*7 = 105 整除~
那么1~1000 里能被105 整除的个数有 1000/105 = 9 余 55
即9 个 分别是: 105,2*105 ,3*105, 4*105 ,5* 105 6 *105 7*105 8*105 9*105~

3,5和7的最小公倍数=3*5*7=105
1000÷105=9……55
1到1000能同时被3 5 7整除的数的个数9个