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 ...
随机推荐
- laravel——ajax分页&删除&搜索
一.视图代码 /*搜索*/<form action="javascript:search_brand()" name="searchForm"> & ...
- 处理npm publish报错问题
上传项目到npm-->为社会做贡献 首先你得有一个项目 npm init 生成package.json 来设置相信息 注册登录npm:npm adduser 输入你的一些信息 查看当前npm登录 ...
- 内置函数&匿名函数
1.内置函数 Built-in Functions abs() dict() help() min() setattr() all() dir() hex() next() slice ...
- Flex4之皮肤定制
Flex4之皮肤定制[Skin类和Skin类] 博客分类: RIA-Flex4专栏 FlexAdobeUPFlashUI 第一.关于spark.skin.SparkSkin类的 1. ...
- mysql 表关联批量更新
项目中最近遇到了需要手动修改某个表的某个字段的数据,但是这个数据是来自别的表,需要关联,所以需要用到关联的批量更新,特此记录一下. UPDATE t_account_trans_info AS iiI ...
- java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context 错误
spring boot 项目启动报错:原因一般是注入了相同名字的service -- :: com.gxcards.mes.MainWwwWeb: logStartupProfileInfo INFO ...
- C# 抽象类和接口的差别
抽象类和接口最终目的:抽象类实现多态化,接口实现功能化.比如汽车:接口就是轮子,发动机,车身等零部件,抽象类则是颜色,款式,型号等参数性东西. 抽象类(abstract): (1) 抽象方法只作声明, ...
- CSS中的单位px、em、rem、%、vw、vh、vm
px 相对长度单位,像素px 是相对于显示器屏幕分辨率而言的.是我们网页设计常用的单位,也是基本单位. 通过 px 可以设置固定的布局或者元素大小,缺点是没有弹性.用 px 设置字体大小时,比较稳定和 ...
- CodeIgniter框架解析
转载于:https://www.cnblogs.com/xiaoxiaoqingyi/p/6901654.html 转载仅为以后自己学习. 业余花了点时间看看CodeIgniter框架(简称CI),C ...
- 在python3里面使用ueditor(基于adminx)
第一步,下载ueditor,在git上下载 直接download : https://github.com/twz915/DjangoUeditor3/ 然后放到任何一个文件夹里面 配置setting ...