Problem 10
Problem 10
# Problem_10.py
"""
The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.
Find the sum of all the primes below two million.
找出两百万一下的质数之和
"""
import math
primes = [] for i in range(2, 2000001):
flag = True
for x in range(2, int(math.sqrt(i))+1):
if i % x == 0:
flag = False
if flag:
print(i)
primes.append(i) print(primes)
print(sum(primes))
Problem 10的更多相关文章
- Project Euler Problem 10
Summation of primes Problem 10 The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. Find the sum of ...
- uoj problem 10
uoj problem 10 题目大意: 给定任务若干,每个任务在\(t_i\)收到,需要\(s_i\)秒去完成,优先级为\(p_i\) 你采用如下策略: 每一秒开始时,先收到所有在该秒出现的任务,然 ...
- leetcode problem 10 Regular Expression Matching(动态规划)
Implement regular expression matching with support for '.' and '*'. '.' Matches any single character ...
- (Problem 10)Summation of primes
The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. Find the sum of all the primes below two milli ...
- Problem 10: Summation of primes
def primeslist(max): ''' 求max值以内的质数序列 ''' a = [True]*(max+1) a[0],a[1]=False,False for index in rang ...
- Common Bugs in C Programming
There are some Common Bugs in C Programming. Most of the contents are directly from or modified from ...
- 一个简单的 Web 服务器 [未完成]
最近学习C++,linux和网络编程,想做个小(mini)项目. 就去搜索引擎, 开源中国, Sourceforge上找http server的项目. 好吧,也去了知乎. 知乎上程序员氛围好, ...
- electrica writeup
关于 caesum.com 网上上的题目,分类有Sokoban,Ciphers,Maths,Executables,Programming,Steganography,Misc.题目有点难度,在努力奋 ...
- android和linux开发环境建立(驱动层)
流程:安装ubutu14.04操作系统==>安装各种库和应用程序并配置环境变量 1,install ubuntu14.04 为了完全释放PC机的资源,我们安装在主机上,就不用虚拟机来玩了.下面是 ...
随机推荐
- 黑马day01xml 解析方式与原理分析
dom解析方式和sax解析
- hdoj--3488--Tour(KM)
Tour Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Others) Total Submi ...
- 产生冠军--hdoj
产生冠军 Time Limit : 1000/1000ms (Java/Other) Memory Limit : 32768/32768K (Java/Other) Total Submissi ...
- [JavaEE] Apache Maven 入门篇(上)
http://www.oracle.com/technetwork/cn/community/java/apache-maven-getting-started-1-406235-zhs.html 作 ...
- HDU2034 人见人爱 A - B
2019-05-17 09:37:46 加油,加油 !!! 结果要从小到大输出 NULL后面没有空格 m && n == 0才结束 注意:看题仔细,罚时很严重 #include < ...
- JDBC基础02
今日知识 1. sql注入问题2. jdbc批处理3. 事务 SQL注入问题解决 1.什么是sql注入. * 用户通过相关的特殊关键字sql语句非法访问数据库 *例如: Xxx(' or '1'='1 ...
- Kafka .NET操作
Kafaka .NET连接 Kafka目前主流在用的.NET客户端有两个:一个是kafka-net,另外一个是Confluent.Kafka,这里给出使用示例: kafka-net示例: public ...
- vue项目中阻止浏览器返回上一页
vue项目中在某个页面阻止浏览器返回上一页,适用移动端.PC端. 使用场景例如: 首页 与 A页面 来回跳转,那样点击浏览器返回时也会来回跳转,本想当页面在首页的时候就不再返回了,所以这个时候 ...
- Npgsql使用入门(一)【搭建环境】
首先去官网下载最新数据库安装包 postgresql-9.6.1-1-windows-x64 将postgreSQL9.6注册为windows服务 注意:大小写要正确 D:\Worksoftware\ ...
- AI:**消灭程序员需要一百年吗?
这篇博文真的很长,不过挺有意思.关于智能机器人的发展前景还是很广的,因为每一步都异常艰难,而什么时候可以终止还无法预料,所以程序员没办法失业啊! 转自于图灵社区:http://www.ituring. ...