Problem 7
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的更多相关文章
- 1199 Problem B: 大小关系
求有限集传递闭包的 Floyd Warshall 算法(矩阵实现) 其实就三重循环.zzuoj 1199 题 链接 http://acm.zzu.edu.cn:8000/problem.php?id= ...
- 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 ...
- C - NP-Hard Problem(二分图判定-染色法)
C - NP-Hard Problem Crawling in process... Crawling failed Time Limit:2000MS Memory Limit:262144 ...
- Time Consume Problem
I joined the NodeJS online Course three weeks ago, but now I'm late about 2 weeks. I pay the codesch ...
- Programming Contest Problem Types
Programming Contest Problem Types Hal Burch conducted an analysis over spring break of 1999 and ...
- hdu1032 Train Problem II (卡特兰数)
题意: 给你一个数n,表示有n辆火车,编号从1到n,入站,问你有多少种出站的可能. (题于文末) 知识点: ps:百度百科的卡特兰数讲的不错,注意看其参考的博客. 卡特兰数(Catalan):前 ...
- BZOJ2301: [HAOI2011]Problem b[莫比乌斯反演 容斥原理]【学习笔记】
2301: [HAOI2011]Problem b Time Limit: 50 Sec Memory Limit: 256 MBSubmit: 4032 Solved: 1817[Submit] ...
- [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 ...
- [LeetCode] The Skyline Problem 天际线问题
A city's skyline is the outer contour of the silhouette formed by all the buildings in that city whe ...
- PHP curl报错“Problem (2) in the Chunked-Encoded data”解决方案
$s = curl_init(); curl_setopt($s, CURLOPT_POST, true); curl_setopt($s, CURLOPT_POSTFIELDS, $queryStr ...
随机推荐
- REST当道,NO MVC
前世今生 B/S开发经历了几个时代,如今已经是后MVC时期了. MVC体现了分层和解耦合的概念.从功能和理念上都做出过巨大贡献,使Java B/S开发在面对大型项目时从容不迫,说成是上个十年Java ...
- How to fix yum errors on CentOS, RHEL or Fedora
Yum is a package management tool for installing, updating and removing rpm packages on RedHat-based ...
- Linux中修改系统时间
#date //显示当前日期 #date -s //设置当前时间,只有root权限才能设置,其他只能查看. #date -s 20061010 //设置成20061010,这样会把具体时间设置成空00 ...
- php建立简单的用户留言系统
php建立简单的用户留言系统 样例 addMsg.php--添加留言页面 doAction.php--响应添加留言页面 . viewMsg.php--显示留言页面 目录结构 addMsg.php--添 ...
- 杂项-事务:OLTP(联机事务处理过程)
ylbtech-杂项-事务:OLTP(联机事务处理过程) On-Line Transaction Processing联机事务处理过程(OLTP) 也称为面向交易的处理过程,其基本特征是前台接收的用户 ...
- [xPlugins] jQuery Contextmenu右键菜单
[2012-04-12] Contextmenu 右键菜单 v0.1 版本发布 [功能] 在特定区域弹出右键菜单 [功能] 可以在弹出右键菜单区域内,再屏蔽某个小区域. [功能] 有两种方式添加右键菜 ...
- 10分钟教你Python+MySQL数据库操作
欲直接下载代码文件,关注我们的公众号哦!查看历史消息即可! 本文介绍如何利用python来对MySQL数据库进行操作,本文将主要从以下几个方面展开介绍: 1.数据库介绍 2.MySQL数据库安装和设置 ...
- Keras简单使用
Keras简单使用在keras中建立模型测试自己的图片一些有用的函数(持续更新) Keras简单使用 在keras中建立模型 相对于自己写机器学习相关的函数,keras更能快速搭建模型,流程如下: 通 ...
- [] == ![]为什么是true
我们先来考虑这个问题,console.log([] == false)会打印什么呢? 答案是true.为什么呢? 首先,因为当"=="号两边其中一个是布尔值的话,先把它转换为数字( ...
- damn selenium
Selenium+Python [ˈpaɪθən] 0.Selenium安装 pip install selenium 1.打开了浏览器,后边什么都不干了 需要将浏览器驱动放置在环境变量的目录下. 2 ...