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 ...
随机推荐
- Exception in thread "main" org.apache.ibatis.binding.BindingException: Type interface com.test.bean.groupMapper is not known to the MapperRegistry.
Exception in thread "main" org.apache.ibatis.binding.BindingException: Type interface com. ...
- git误commit大文件导致不能push问题解决
git push时终端报错: error: RPC failed; HTTP 413 curl 22 The requested URL returned error: 413 Request Ent ...
- OO随笔
第一次作业——多项式计算 1.自我程序分析 第一次作业是多项式计算,只使用了一个多项式类.第一次接触面向对象的程序,还比较生疏,不是很能理解面向对象的思想.将读入,处理,计算,都放到了main函数中, ...
- [大数据面试题]storm核心知识点
1.storm基本架构 storm的主从分别为Nimbus.Supervisor,工作进程为Worker. 2.计算模型 Storm的计算模型分为Spout和Bolt,Spout作为管口.Bolt作为 ...
- 关于lower_bound( )和upper_bound( )的常见用法
lower_bound( )和upper_bound( )都是利用二分查找的方法在一个排好序的数组中进行查找的. 在从小到大的排序数组中, lower_bound( begin,end,num):从数 ...
- 102. Binary Tree Level Order Traversal二叉树层序遍历
网址:https://leetcode.com/problems/binary-tree-level-order-traversal/ 参考:https://www.cnblogs.com/grand ...
- strtol详解
文章装载自:http://blog.csdn.net/happylife1527/article/details/8441799,大家看到这篇文章想转载的请注明出处,尊重原作者劳动成果. 今天,在re ...
- ARP协议分析(Wireshark)
一.说明 1.1 背景说明 以前学网络用的谢希仁的<计算机网络原理>,一是网开始学不太懂网络二是ARP协议是没有数据包格式的(如果没记错应该是没有).学完只记得老师说:ARP很简单的,就是 ...
- 从码农到技术总监分享Leader经验
从一个毕业的IT小伙或者一个码农成长为一个管理者,有很多需要转变的思想,那么当你遇到了瓶颈,或许我的经验能帮到你,感谢. 系统的掌握了.NET,JAVA技术,能够熟练的使用springcloud + ...
- Cognos无法解密来着内容库的用户名和密码凭证
1. 问题描述 启动Cognos失败,报错代码为QE-DEF-0368. 2. 问题分析 Frame Work和Cognos Server安装在不同的目录和/或不同的机器上. 3. 解决方案 需要把S ...