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的更多相关文章

  1. 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 ...

  2. Problem 10

    Problem 10 # Problem_10.py """ The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. ...

  3. (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 ...

  4. (Problem 37)Truncatable primes

    The number 3797 has an interesting property. Being prime itself, it is possible to continuously remo ...

  5. (Problem 35)Circular primes

    The number, 197, is called a circular prime because all rotations of the digits: 197, 971, and 719, ...

  6. uoj problem 10

    uoj problem 10 题目大意: 给定任务若干,每个任务在\(t_i\)收到,需要\(s_i\)秒去完成,优先级为\(p_i\) 你采用如下策略: 每一秒开始时,先收到所有在该秒出现的任务,然 ...

  7. (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 ...

  8. Summation of primes

    是我算法不对,还是笔记本CPU太差? 我优化了两次,还是花了三四个小时来得到结果. 在输出上加1就是最终结果. The sum of the primes below 10 is 2 + 3 + 5 ...

  9. 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 ...

随机推荐

  1. 线段树(segment_tree)

    线段树之——区间修改区间查询 1.概述 线段树,也叫区间树,是一个完全二叉树,它在各个节点保存一条线段(即“子数组”),因而常用于解决数列维护问题,基本能保证每个操作的复杂度为O(lgN). 线段树是 ...

  2. selenium java maven testNg环境搭建

    maven获取jar的xml地址:http://mvnrepository.com 步骤一安装jdk(略) 步骤二 安装eclipse(略) 步骤三 安装testNG 步骤四 maven安装 步骤三 ...

  3. 雷林鹏分享:Composer 安装

    下午在安装 Laravel 框架过程中,遇到了不少问题,因为 Laravel 的安装依赖于 composer,这里就先介绍一下 composer 的安装方法: 安装方法: #下载 sudo curl ...

  4. Ketlle

    public class Kettle { private int volume; public Kettle(int water) {  volume =water;  System.out.pri ...

  5. CentOS6.5利用Docker部署ShowDoc

    在Docker中部署ShowDoc 一.安装Docker 1.安装Docker yum install docker 最后出现Complete即可 2.启动服务 # service docker st ...

  6. if-else语句

    C语言自学之if-else语句 Dome : 今年是2014年编写程序判断今年是闰年还是平年. 请在代码编辑器中使用简单if-else语句补全代码,判断今年是否是闰年. 运行结果: 今年是平年 #in ...

  7. 微信小程序笔记

    1.文件的作用 js,wxml,wxss,json 所有页面中要用到的变量,都放在可了pages目录下 wxml:类似于html文件 wxss:类似于css文件(类, id, 标签,子代,后代,bef ...

  8. Node.js 8 中的 util.promisify的详解

    Node.js 8带来了 很多新特性 .其中比较值得注意的,便有 util.promisify() 这个方法. util.promisify() 虽然 Promise 已经普及,但是 Node.js ...

  9. 如何正确可视化RAW(ARW,DNG,raw等格式)图像?

    为了正确可视化RAW图像,需要做好:白平衡.提亮以及色彩映射. import numpy as np import struct from PIL import Image import rawpy ...

  10. 刷题upupup【Java中HashMap、HashSet用法总结】

    HashMap: 常用操作 1. containsKey() 判断HashMap是否包含key 2. containsValue() 判断HashMap是否包含“值为value”的元素 3. get( ...