欧拉计划

来源:互联网 发布:数据恢复哪个好用 编辑:程序博客网 时间:2024/06/13 03:24

今天第一次看到欧拉计划,感觉很兴奋,决定挑战一下。
什么是欧拉计划?
欧拉计划是一系列挑战数学、计算机编程的问题。
第一题:
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.Find the sum of all the multiples of 3 or 5 below 1000.
示例:

def divid(x):    return x % 3 == 0 or x % 5 ==0sum = 0for num in filter(divid, range(1,1000)):    sum += numprint(sum)
233168
0 0