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. php接口签名验证

    在做一些api接口设计时候会遇到设置权限问题,比如我这个接口只有指定的用户才能访问. 很多时候api接口是属于无状态的,没办法获取session,就不能够用登录的机制去验证,那么 大概的思路是在请求包 ...

  2. SearchScore

    static void Main(string[] args) { Console.WriteLine("请输入要查询的学生姓名!"); string nameToQuery = ...

  3. 换行符java去除字符串中的空格、回车、换行符、制表符

    import java.util.regex.Matcher; import java.util.regex.Pattern; /** * @author lei * 2011-9-2 */ publ ...

  4. Django的form表单

    html的form表单 django中,前端如果要提交一些数据到views里面去,需要用到 html里面的form表单. 例如: # form2/urls.py from django.contrib ...

  5. docker容器配置nginx负载均衡 -----加权

    首先要准备三个nginx的容器: 第二个容器: 第三个容器: 进入第一个容器  要配置的容器(docker exec -it 容器名 /bin/bash) vi /usr/local/nginx/co ...

  6. PHP随机生成要求位数个字符(大小写字母+数字)

    php随机生成要求位数个字符 /** * 随机生成要求位数个字符 * @param length 规定几位字符 */ function getRandChar($length){ $str = nul ...

  7. 【实战问题】【3】iPhone无法播放video标签中的视频

    问题:视频都是MP4格式,视频可以在手机上正常播放.video标签中的视频在安卓点击可以播放,但在iPhone无法播放 解决方案: 1,视频编码格式问题,具体iPhone手机支持的是哪些格式可见官方的 ...

  8. linux命令:使用less从后向前查看日志信息

    线上出问题的时候,我们常用tail-n 或者tail-f或者grep或者vicat等各种命令去查看异常信息,但是日志是在不停地刷屏,tail是动态的在变的,我们往往期望从日志最后一行往前一页一页的翻页 ...

  9. linux 常用指令

    w 指令可以看到目前接入到服务器的用户(终端)history xx 可以查看本用户(本终端)最后执行的xx条指令last 指令可以查看登录的日志grep "str" filName ...

  10. var that = this 小坑记

    在js编码过程中,经常会使用如上的语句来规避拿不到变量的问题. 比如: queryData:function () { var that=this; var param={}; for(var key ...