https://projecteuler.net/problem=10
2016-02-25 14:36
453 查看
Summation of primes
Problem 10
The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.Find the sum of all the primes below two million.
此题就是考察素筛法,如果一个一个算,没太大必要
primelist = [True] * 2000001
for i in range(2,2000001):
if primelist[i] == True:
temp = i * 2
while temp < 2000001:
primelist[temp] = False
temp += i
result = 0
for i in range(2,2000001):
if primelist[i] == True:
result += i
print(result)
相关文章推荐
- Http错误代码
- https://projecteuler.net/problem=9
- lighttpd-1.4.39 : connection
- 连接数据的网络交互
- 工作需要用到C++中的正则表达式,所以就研究了以上三种正则。 http://www.cnblogs.com/pmars/archive/2012/10/24/2736831.html
- DHCP2:为什么叫做动态主机配置,而不是动态网络配置
- tcpwatch1.3
- 利用AFNetworking 的AFHTTPSessionManager代码实现代理的方式访问任意指定IP地址,解决域名DNS上的问题
- register(cp:http://blog.sina.com.cn/s/blog_6a1837e90101128k.html)
- curl http_code 状态码 意义及信息
- Xcode7 使用NSURLSession发送HTTP请求报错
- 通过AFHTTPSessionManager+RACSupport 或 AFHTTPRequestOperationManager+RACSupport 解决同一信号源(RAC网络请求两次的问题
- httpUrlConnection的參数具体解释
- 人工智能AI-机器视觉CV-数据挖掘DM-机器学习ML-神经网络-[资料集合贴]
- 分布式系统中不可靠的TCP
- 深度神经网络算法的实现
- http://jackwang1.blog.163.com/blog/static/39534478201182651610201/
- httpClient中的get和post请求
- 鸟哥的Linux私房菜(服务器)- 第十二章、网络参数控管者: DHCP 服务器
- 鸟哥的Linux私房菜(服务器)- 第七章、网络安全与主机基本防护: 限制端口, 网络升级与 SELinux