Problem 10: Summation of primes
def primeslist(max):
'''
求max值以内的质数序列
'''
a = [True]*(max+1)
a[0],a[1]=False,False
for index in range(2, len(a)):
if a[index]==True:
for i in range(index+index,len(a),index):
a[i]=False
return [i for i, j in enumerate(a) if j==True] temp = primeslist(2000000) print(sum(temp))
Problem 10: Summation of primes的更多相关文章
- 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 ...
- Problem 10
Problem 10 # Problem_10.py """ The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. ...
- (Problem 47)Distinct primes factors
The first two consecutive numbers to have two distinct prime factors are: 14 = 2 7 15 = 3 5 The fi ...
- (Problem 37)Truncatable primes
The number 3797 has an interesting property. Being prime itself, it is possible to continuously remo ...
- (Problem 35)Circular primes
The number, 197, is called a circular prime because all rotations of the digits: 197, 971, and 719, ...
- uoj problem 10
uoj problem 10 题目大意: 给定任务若干,每个任务在\(t_i\)收到,需要\(s_i\)秒去完成,优先级为\(p_i\) 你采用如下策略: 每一秒开始时,先收到所有在该秒出现的任务,然 ...
- (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 ...
- Summation of primes
是我算法不对,还是笔记本CPU太差? 我优化了两次,还是花了三四个小时来得到结果. 在输出上加1就是最终结果. The sum of the primes below 10 is 2 + 3 + 5 ...
- projecteuler 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 ...
随机推荐
- Python中4位1进制数与float浮点数互相转换
import struct s = 'F4CEF042' print(s) #<是小端,>是大端,f代表浮点数 print(struct.unpack('<f', bytes.fro ...
- 将nginx、mysql、php添加至环境变量
1.问题描述: 修改完nginx配置后想重启nginx服务,执行nginx -s reload 返回了 -bash: nginx: command not found 2.原因: 没有配置环境变量,找 ...
- Gradle 依赖管理
依赖管理(在 build.gradle 中): 1.定义依赖仓库(repositories): Gradle 要求至少定义一个依赖仓库,依赖仓库可以是文件系统,也可以是中心服务器.最常用的是 jcen ...
- ios高级开发之多线程(二)NSThread技术
多线程技术是有多套解决方案的,那么我们该如何选择呢? 技术方案 简介 语言 线程生命周期 使用频率 pthread 1.一套通用的多线程API 2.适用于UNIX,linux,windows等 3.跨 ...
- java.lang.ClassNotFoundException: javax.servlet.SessionCookieConfig
使用 MockMvc 模拟进行单元测试时出现以下的错误,网上看到的资料应该是说Spring4.0需要servlet3.0的支持? 在pom.xml更改servlet的版本依赖后即可
- java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: AAPT2 error: check logs for details
Caused by: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Except ...
- 【转】LVDS基础、原理、图文讲解
转自:https://blog.csdn.net/wangdapao12138/article/details/79935821 LVDS是一种低摆幅的差分信号技术,它使得信号能在差分PCB 线对或平 ...
- xadmin邮箱验证码 标题 EmailVerifyRecord object
[修改users-models模块] 1.如果这样不生效 def __unicode__(self): return '{0}({1})'.format(self.code, self.email) ...
- 使用 jquery.wordexport.js导出的Word排版
js导出word文档所需要的两个插件: FileSaver.js jquery.wordexport.js 使用jquery.wordexport.js这个插件导出的word文档的排版方式: 编辑器打 ...
- C++标准模板库(STL)之Pair
1.Pair的常用用法 pair:两个元素绑在一起作为一个合成元素.可以看成是两个元素的结构体. struct pair { typeName1 first; typeName2 second; }; ...