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 ...
随机推荐
- Vue-admin工作整理(五):守卫导航
一.作用: 它可以帮我们在路由发生跳转,到导航结束的时间内,做一些相应的逻辑处理,分为:全局守卫,和专项守卫 1.全局收尾: (a).前置守卫:router.beforeEach(to,from,ne ...
- logic pro x 下载
https://pan.baidu.com/s/1gfO5KOV
- allure--下的各装饰器的翻译及自己的总结
翻译图-快捷键 红色字体感觉用的会比较多,起码现在感觉应该是比其他的多一点 lable应该没有什么特殊的用法,只是对下面方法的一个汇总(或者可以这么说,下面的方法是lable更具体的实现) sever ...
- 解决[Errno 10048]报错
最近一直很纳闷,写的python程序在自己电脑上运行得非常顺利,放到远程测试机上经常报“[Errno 10048]通常每个套接字地址(协议/网络地址/端口)“这样的错误,百度到这种是端口号冲突引起的, ...
- python 中的 yield 究竟为何物?生成器和迭代器的区别?
当你突然看到别人的代码中出现了一个好像见过但又没用过的关键词 比如 yield ,你是否会觉得这段代码真是高大上呢? 或许只有我这种小白才会这样子觉得,就在刚刚,我就看见了别人的代码中的yield,觉 ...
- OLLVM特性、使用原理
一.OLLVM特性 目前ollvm支持的特性有以下几种: 指令替换 -mllvm -sub 虚假控制流 -mllvm -bcf 打平控制流 -mllvm -fla 函数(Funtions)注解 二.指 ...
- IIS部署发布flask网站
先参考http://python.jobbole.com/87655/,会发现失败. 再参考https://blog.csdn.net/david_lee13/article/details/8198 ...
- python--日志模块
一.logging模块就是python里面用来操作日志的模块,logging模块中主要有4个类,分别负责不同的工作 1. Logger 记录器,暴露了应用程序代码能直接使用的接口:简单点说就是一个创建 ...
- 笔记《JavaScript 权威指南》(第6版) 系统理论知识概要
主要内容概要 [JavaScript语言核心]词法结构,类型.值和变量,表达式和运算符,语句,对象,数组,函数,类和模块,正则表达式的模式匹配,JavaScript的子集和扩展,服务器端JavaScr ...
- 学号 2018-2019-20175212 童皓桢《Java程序设计》第5周学习总结
学号 2018-2019-20175212 <Java程序设计>第5周学习总结 教材学习内容总结 接口 声明接口: interface 名字: 接口体:接口体中只有常量无变量,只有抽象方法 ...