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 ...
随机推荐
- C#实现基于ffmpeg加虹软的人脸识别demo及开发分享
对开发库的C#封装,屏蔽使用细节,可以快速安全的调用人脸识别相关API.具体见github地址.新增对.NET Core的支持,在Linux(Ubuntu下)测试通过.具体的使用例子和Demo详解,参 ...
- python日志模块的使用
学习一下python的日志模块logging,可以参考如下博客,写得很详细 https://www.cnblogs.com/yyds/p/6901864.html https://www.cnblog ...
- C# interface 的隐式与显示实现及适应范围源码演示
把代码过程中经常用到的一些代码段做个记录,如下的资料是关于C# interface 的隐式与显示实现及适应范围演示的代码. interface IAnimal { void Dog(); } clas ...
- Android Satudio的使用记录
Satudio的使用记录之导入新项目: Satudio导入项目的心得[基本分为4步完成]1.需要保证自己的satudio中项目能够运行,同时找到该工作空间的和项目的各个参数 {项目-->右键—— ...
- cron定时任务
1.确认系统安装了cron rpm -aq | grep crontabs 2.认识cron时间格式 3.生成定时任务 crontab -e #进入任务命令编辑模式 30 7,12,20 * * * ...
- SpringBoot之配置文件加载位置
1.SpringBoot启动会扫描application.properties或者application.yml文件作为springboot的配置文件.默认创建项目生成application.prop ...
- 一道面试题引发对javascript事件循环机制(Event Loop)的 思考(这里讨论针对浏览器)
- ASP.NET 发送邮件 SMTP
目录 // 邮件信息 对象 MailMessage mail = new MailMessage(); //新建邮件SMTP客户端 对象 用于发送 ...
- 在python3里面使用ueditor(基于adminx)
第一步,下载ueditor,在git上下载 直接download : https://github.com/twz915/DjangoUeditor3/ 然后放到任何一个文件夹里面 配置setting ...
- 使用jsdelivr访问github资源
一.新建github库并使用git上传 首先访问https://github.com 新建自己的库 之后使用 git 上传到github 下载git : https://git-for-windows ...