Problem 10
Problem 10
# Problem_10.py
"""
The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.
Find the sum of all the primes below two million.
找出两百万一下的质数之和
"""
import math
primes = [] for i in range(2, 2000001):
flag = True
for x in range(2, int(math.sqrt(i))+1):
if i % x == 0:
flag = False
if flag:
print(i)
primes.append(i) print(primes)
print(sum(primes))
Problem 10的更多相关文章
- 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 ...
- uoj problem 10
uoj problem 10 题目大意: 给定任务若干,每个任务在\(t_i\)收到,需要\(s_i\)秒去完成,优先级为\(p_i\) 你采用如下策略: 每一秒开始时,先收到所有在该秒出现的任务,然 ...
- leetcode problem 10 Regular Expression Matching(动态规划)
Implement regular expression matching with support for '.' and '*'. '.' Matches any single character ...
- (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 ...
- Problem 10: Summation of primes
def primeslist(max): ''' 求max值以内的质数序列 ''' a = [True]*(max+1) a[0],a[1]=False,False for index in rang ...
- Common Bugs in C Programming
There are some Common Bugs in C Programming. Most of the contents are directly from or modified from ...
- 一个简单的 Web 服务器 [未完成]
最近学习C++,linux和网络编程,想做个小(mini)项目. 就去搜索引擎, 开源中国, Sourceforge上找http server的项目. 好吧,也去了知乎. 知乎上程序员氛围好, ...
- electrica writeup
关于 caesum.com 网上上的题目,分类有Sokoban,Ciphers,Maths,Executables,Programming,Steganography,Misc.题目有点难度,在努力奋 ...
- android和linux开发环境建立(驱动层)
流程:安装ubutu14.04操作系统==>安装各种库和应用程序并配置环境变量 1,install ubuntu14.04 为了完全释放PC机的资源,我们安装在主机上,就不用虚拟机来玩了.下面是 ...
随机推荐
- 我要带徒弟学JAVA架构 ( 写架构,非用架构 )
80元,当然我不觉得我带的徒弟比花了1万多在培训班学习的学生差,你努力了.会比他们出色的多.等你学有所成.相同能够成为jeecg核心成员之中的一个.一起构建Java学习平台.你也能够成为非常好的师傅. ...
- rac环境改动spfile后遭遇ora-29250小例
原创作品.出自 "深蓝的blog" 博客.转载时请务必注明出处,否则有权追究版权法律责任. 深蓝的blog:http://blog.csdn.net/huangyanlong/ar ...
- Java高级程序猿技术积累
watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQveDczNDQwMDE0Ng==/font/5a6L5L2T/fontsize/400/fill/I0JBQk ...
- 数据结构之---C语言实现广义表头尾链表存储表示
//广义表的头尾链表存储表示 //杨鑫 #include <stdio.h> #include <malloc.h> #include <stdlib.h> #in ...
- Vue环境搭建+VSCode+Win10
一.安装Node.js(js的运行环境) 1.在Node.js官网https://nodejs.org/en/download/下载安装包.2.下载后进行安装.3.打开命令行,输入node -v可以查 ...
- 读懂diff【转】
本文转载自:http://www.ruanyifeng.com/blog/2012/08/how_to_read_diff.html 读懂diff 作者: 阮一峰 日期: 2012年8月29日 d ...
- 深入理解groupByKey、reduceByKey区别——本质就是一个local machine的reduce操作
下面来看看groupByKey和reduceByKey的区别: val conf = new SparkConf().setAppName("GroupAndReduce").se ...
- solaris 10 关闭ftp、telnet
安装solaris10,启动后发现找不到ftp.telnet的关闭方法, 管理命令 svcadm(服务状态管理,启动.停止等) # svcs 查看当前所有的服务状态,可以使用|管道符重定向作更个性化的 ...
- [hihicoder][Offer收割]编程练习赛47
删除树节点 #pragma comment(linker, "/STACK:102400000,102400000") #include<stdio.h> #inclu ...
- 微信小程序video组件出现无法播放或卡顿
微信小程序使用video组件播放视频的时候,会出现卡顿或者无法播放的问题,加一个custom-cache=”true“即可解决,这个属性文档上没有,是从小程序开发社区中get到的.