对小于28124的每个自然数,与第21题类似,先用筛法求出并保存所有真约数之和,再从中挑选出盈数并两两求和,最后遍历1到28123,找出不在盈数和中的数即可。结果是$4179871$。
dSum=[1 for i in range(28124)]
for d in range(2,28124):
for i in range(d+d,28124,d):
dSum[i]+=d
abList=[i for i in range(12,28124) if dSum[i]>i]
s=set([i+j for i in abList for j in abList if i+j<28124])
print sum(i for i in range(1,28124) if i not in s)
|