Problem 7

# Problem_7.py
"""
By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.
What is the 10 001st prime number?
第10001个质数是什么?
质数定义为在大于1的自然数中,除了1和它本身以外不再有其他因数。
"""
primes = [] for i in range(2, 999999):
flag = True
for x in range(2, i):
if i % x == 0:
flag = False
break
if flag:
print(i)
primes.append(i)
if len(primes) == 10001:
break print(primes)
print(primes[-1])

Problem 7的更多相关文章

  1. 1199 Problem B: 大小关系

    求有限集传递闭包的 Floyd Warshall 算法(矩阵实现) 其实就三重循环.zzuoj 1199 题 链接 http://acm.zzu.edu.cn:8000/problem.php?id= ...

  2. No-args constructor for class X does not exist. Register an InstanceCreator with Gson for this type to fix this problem.

    Gson解析JSON字符串时出现了下面的错误: No-args constructor for class X does not exist. Register an InstanceCreator ...

  3. C - NP-Hard Problem(二分图判定-染色法)

    C - NP-Hard Problem Crawling in process... Crawling failed Time Limit:2000MS     Memory Limit:262144 ...

  4. Time Consume Problem

    I joined the NodeJS online Course three weeks ago, but now I'm late about 2 weeks. I pay the codesch ...

  5. Programming Contest Problem Types

        Programming Contest Problem Types Hal Burch conducted an analysis over spring break of 1999 and ...

  6. hdu1032 Train Problem II (卡特兰数)

    题意: 给你一个数n,表示有n辆火车,编号从1到n,入站,问你有多少种出站的可能.    (题于文末) 知识点: ps:百度百科的卡特兰数讲的不错,注意看其参考的博客. 卡特兰数(Catalan):前 ...

  7. BZOJ2301: [HAOI2011]Problem b[莫比乌斯反演 容斥原理]【学习笔记】

    2301: [HAOI2011]Problem b Time Limit: 50 Sec  Memory Limit: 256 MBSubmit: 4032  Solved: 1817[Submit] ...

  8. [LeetCode] Water and Jug Problem 水罐问题

    You are given two jugs with capacities x and y litres. There is an infinite amount of water supply a ...

  9. [LeetCode] The Skyline Problem 天际线问题

    A city's skyline is the outer contour of the silhouette formed by all the buildings in that city whe ...

  10. PHP curl报错“Problem (2) in the Chunked-Encoded data”解决方案

    $s = curl_init(); curl_setopt($s, CURLOPT_POST, true); curl_setopt($s, CURLOPT_POSTFIELDS, $queryStr ...

随机推荐

  1. 奇妙的go语言(基本的语法)

    [ 声明:版权全部,欢迎转载,请勿用于商业用途.  联系信箱:feixiaoxing @163.com] 学习一门新的语言无非就是从主要的语法開始的.通过语法书来学习语言毕竟是很枯燥的,所以我们最好还 ...

  2. Kafka中文文档学习笔记

    文档位置: /Users/baidu/Documents/Data/Interview/机器学习-数据挖掘/Kafka 据说是目前见到的最好的 Kafka 中文文章 . Kafka 是一个消息系统,原 ...

  3. jdbc 读取oracle long raw 字段,里面存的是文本

    jdbc 读取oracle long raw 字段,里面存的是文本 参考: http://singlewolf.iteye.com/blog/278769 http://blog.csdn.net/r ...

  4. HDU 4906 Our happy ending (状压DP)

    HDU 4906 Our happy ending pid=4906" style="">题目链接 题意:给定n个数字,每一个数字能够是0-l,要选当中一些数字.然 ...

  5. PHP设计模式之 单例模式 工厂模式 实例讲解

    单例模式又称为职责模式,它用来在程序中创建一个单一功能的访问点,通俗地说就是实例化出来的对象是唯一的.所有的单例模式至少拥有以下三种公共元素:1. 它们必须拥有一个构造函数,并且必须被标记为priva ...

  6. 复制DropDownList

    DropDownList ddlA; ListItem[] ar = new ListItem[ddlB.Items.Count]; ddlB.Items.CopyTo(ar,0); ddlA.Dat ...

  7. Visio的安装教程

    1.下载地址:https://msdn.itellyou.cn/ 2.输入关键字:Visio,选择想要下载的版本,展开详细信息,并复制 3.(我下载的13) ed2k://|file|cn_visio ...

  8. java.lang.RuntimeException: Unable to get provider

    java.lang.RuntimeException: Unable to get provider  dev.dworks.apps.candidcamera.provider.MediaDocum ...

  9. 2017-3-11 leetcode 217 219 228

    ji那天好像是周六.....吃完饭意识到貌似今天要有比赛(有题解当然要做啦),跑回寝室发现周日才开始233333 =========================================== ...

  10. Npgsql使用入门(一)【搭建环境】

    首先去官网下载最新数据库安装包 postgresql-9.6.1-1-windows-x64 将postgreSQL9.6注册为windows服务 注意:大小写要正确 D:\Worksoftware\ ...