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 ...
随机推荐
- 稠州银行数字化转型:打造银行数据大脑,建立全新数字化DNA
数字经济时代,银行如何进行数字化转型?业务模式转型与科技转型如何协同并进? 2019年1月4日,在上海蚂蚁金服ATEC城市峰会上,浙江稠州商业银行(以下简称“稠州银行”)副行长兼首席信息官程杰分享了稠 ...
- Windows安装zookeeper 单机版
首先需要安装JdK,从Oracle的Java网站下载,安装很简单,就不再详述. 1.下载zookeeper, https://mirrors.tuna.tsinghua.edu.cn/apache/z ...
- [Web Service] Tutorial Basic Concepts
WSDL是网络服务描述语言,是一个包含关于web service信息(如方法名,方法参数)以及如何访问它. WSDL是UDDI的一部分. 作为web service 应用程序之间的接口,发音为wiz- ...
- python-获取URL中的json数据
数据源为某系统提供的URL,打开是json文件,python代码获取如下: URL替换成自己的即可. import urllib.request def get_record(url): resp = ...
- cowboy源码分析(一)
前段时间导读了ranch的源码,具体见ranch 源码分析(一), 现在整理了下ranch框架下经典应用cowboy. 源码地方:https://github.com/ninenines/cowboy ...
- L - Non-Prime Factors (质数筛选+因子分解)
In many programming competitions, we are asked to find (or count the number of) Prime Factors of an ...
- 8.2 GOF设计模式一: 单实例模式 SingleTon
GOF设计模式一: 单实例模式 SingleTon 整个美国,只有一个“现任美国总统” 比如,在学校,“老师”,有数百个:“校长”,只有一个 系统运行时,如何保证某个类只允许实例化一个对象 ...
- 大数据分析-excel常用技巧
在用EXCEL制表时,经常要要用到填充,比如1到100行内容相同或引用公式,大多数人会用鼠标拖来拖去,例如: 在第一行的A1单元格右下方 鼠标指针 变 实心黑十字 向下拉或向右,向左拉 我想拉100行 ...
- java 使用GET请求编码问题解决
java GET请求解决编码的有效代码前端: encodeURI(encodeURI("你好") 后端代码: String name = request.getParameter( ...
- python--日志模块
一.logging模块就是python里面用来操作日志的模块,logging模块中主要有4个类,分别负责不同的工作 1. Logger 记录器,暴露了应用程序代码能直接使用的接口:简单点说就是一个创建 ...