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 ...
随机推荐
- KAFKA跨主机部署网络不通解决思路
Kafka的部署不仅需要集群可用,同时需要对orderer节点可连,这就是为什么有的时候,kafka集群本身没问题,但是orderer却总是报错. 为了试验kafka剥离方案的可行性,跨阿里云网络和内 ...
- vue全局组件-父子组件传值
全局组件注册方式:Vue.component(组件名,{方法}) demo: 子组件:upload.vue <template> <div > <div class=&q ...
- Pycharm快捷键设置(鼠标滚动控制字体大小)
一.pycharm字体放大的设置 File —> setting —> Keymap —>在搜寻框中输入:increase —> Increase Font Size(双击) ...
- PyQt5——隐藏控件并保留位置
原文地址:https://blog.csdn.net/qq_38161040/article/details/86605798 ———————————————————————————————— 设置控 ...
- Java_JVM参数-XX:MaxDirectMemorySize 与 两种 ByteBuffer: heap,direct ByteBuffer
ByteBuffer有两种: heap ByteBuffer -> -XX:Xmx 1.一种是heap ByteBuffer,该类对象分配在JVM的堆内存里面,直接由Java虚拟机负责垃圾回收, ...
- delphi提示“Undeclared identifier”TForm的缺少引用单元列表
在interface uses 添加TForms;
- My Team——面向对象与软件工程实验三
My Team 一.Name GDTX(团队成员姓氏的拼音首字母组成) 二.项目描述 微信小程序(小洁便签): 1,功能齐全:小洁便签具有大多数便签APP所具有的添加.查看.修改和删除便签内容以及插入 ...
- js 获取昨天,今天,本周,上周,季度等时间范围(封装的js)
(function ($, ht) { "use strict"; $.extend(ht, { clickTimeRange:function(){ //点击重置按钮,时间文本框 ...
- HIT2019春软件构造->Git&Github学习笔记
由于软件构造课程需要,学习使用git,以下作为学习笔记. 一.Git初始化及仓库创建和操作 1.基本信息设置(设置签名) 命令 项目级别/仓库级别:仅在当前本地库范围内有效 git ...
- oracleDBconsole服务启动失败
问题出现的故障: 在一次正常使用企业管理器后,重新启动计算机,再次启动OracleDBConsoleORCL服务时,报:Windows 不能在 本地计算机 启动 OracleDBConsoleo ...