python 求10亿以内和987654互质正整数的和
2020-11-28 09:13
标签:blog class code int com cti 加群看见的 但是计算好慢,谁有更优的算法,麻烦说一下。 510904124706116762 python 求10亿以内和987654互质正整数的和,搜素材,soscw.com python 求10亿以内和987654互质正整数的和 标签:blog class code int com cti 原文地址:http://www.cnblogs.com/zhangjiaxing/p/3704421.html
factor
=
[]
for
x
in
xrange
(
1
,
987654
/
/
2
+
1
):
if
987654
%
x
=
=
0
:
factor.append(x)
sum
=
0
for
y
in
xrange
(
1
,
1000000000
):
for
z
in
factor:
if
y
%
z
=
=
0
:
sum
+
=
y
print
sum