Problem 7: 10001st prime
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?
max1 = 10001
a = [2]
i = 3
while len(a) < max1:
flag = 0
for j in a:
if j > i**0.5:
break
if i%j == 0:
flag = 1
break
if flag == 0:
a.append(i)
i+=2 print(a[-1])
Problem 7: 10001st prime的更多相关文章
- (Problem 49)Prime permutations
The arithmetic sequence, 1487, 4817, 8147, in which each of the terms increases by 3330, is unusual ...
- (Problem 7)10001st prime
By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. ...
- algorithm@ Sieve of Eratosthenes (素数筛选算法) & Related Problem (Return two prime numbers )
Sieve of Eratosthenes (素数筛选算法) Given a number n, print all primes smaller than or equal to n. It is ...
- projecteuler 10001st prime (求出第10001个质数)
By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. ...
- Problem 3: Largest prime factor
The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 60085 ...
- Project Euler:Problem 41 Pandigital prime
We shall say that an n-digit number is pandigital if it makes use of all the digits 1 to n exactly o ...
- Python练习题 035:Project Euler 007:第10001个素数
本题来自 Project Euler 第7题:https://projecteuler.net/problem=7 # Project Euler: Problem 7: 10001st prime ...
- poj 3126 Prime Path bfs
题目链接:http://poj.org/problem?id=3126 Prime Path Time Limit: 1000MS Memory Limit: 65536K Total Submi ...
- POJ3126 Prime Path —— BFS + 素数表
题目链接:http://poj.org/problem?id=3126 Prime Path Time Limit: 1000MS Memory Limit: 65536K Total Submi ...
随机推荐
- 用户端访问centos7上面的tomcat,访问页面出现的非常的慢?
原因:因为客户端访问centos7上面的tomcat会先 建立session连接,这个连接会用到random的随机数,在linux系统中有一个熵池的概念(熵池是一个内核参数), 他要 用熵池里面的随机 ...
- 2017-2018 ACM-ICPC German Collegiate Programming Contest (GCPC 2017)
A Drawing Borders 很多构造方法,下图可能是最简单的了 代码: #include<bits/stdc++.h> using namespace std; ; struct ...
- reactiveCocoa使用注意点
@RACSubject信号 注意点:1如果一个页面需要多次发送这个消息,那么似乎会暴露一个bug,信号不会被销毁,等到发送第二个信号 时,第一个信号仍然会被发送,导致错误,比如一个tableView的 ...
- Python --判断路径是否为目录或文件
os.path.isdir( ), os.path.isfile(),os.listdir( ), os.walk( ) 参考网址:https://blog.csdn.net/xxn_723911/a ...
- Java并发编程相关知识整理
1.什么是进程.线程.多线程? 进程当一个程序开始运行时,它就是一个进程,进程包括运行中的程序和程序所使用到的内存和系统资源.进程间通讯依靠IPC资源,例如管道.套接字 线程是程序中的 ...
- 网络爬虫&起点中文网完本榜500部小说
# 网络爬虫爬取起点中文网完本榜小说500部# 四步,分步操作,不易出错# 所需要获取的数据:书名 .作者.网址.类型.主要介绍.作品信息 from urllib.request import * # ...
- 第一个Azure应用
https://www.azure.cn/zh-cn/ 学习Azure,首先看的是官网Azure介绍,因为用到了虚拟机及存储等因此,着重看这两块. 本文Demo是通过API发送消息,当收到消息后新建虚 ...
- sql server error 53
主要是计算机名修改了,通过服务器名称,浏览更多,选择“数据库引擎”里面的第一个,就可以登陆了
- bash: ./xxx 权限不够
Linux环境下要运行C编译的一个可执行文件play,终端cd到当前目录后输入./play,提示 bash: ./xxx 权限不够 用sudo, 提示 sudo:./play: command no ...
- Intellij IDEA 自动清除无效 import
打开偏好设置: 输入auto import: 注:想在以后的工程中都自动清除,可以在File中如下图操作: