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的更多相关文章

  1. (Problem 49)Prime permutations

    The arithmetic sequence, 1487, 4817, 8147, in which each of the terms increases by 3330, is unusual ...

  2. (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. ...

  3. 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 ...

  4. 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. ...

  5. 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 ...

  6. 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 ...

  7. Python练习题 035:Project Euler 007:第10001个素数

    本题来自 Project Euler 第7题:https://projecteuler.net/problem=7 # Project Euler: Problem 7: 10001st prime ...

  8. poj 3126 Prime Path bfs

    题目链接:http://poj.org/problem?id=3126 Prime Path Time Limit: 1000MS   Memory Limit: 65536K Total Submi ...

  9. POJ3126 Prime Path —— BFS + 素数表

    题目链接:http://poj.org/problem?id=3126 Prime Path Time Limit: 1000MS   Memory Limit: 65536K Total Submi ...

随机推荐

  1. Ubuntu下的Selenium爬虫的配置

    在服务器Ubuntu系统上跑爬虫,爬虫是基于Selenium写的,遇到好几个问题,现在这里记录一下. 1. 安装环境 阿里云,Ubuntu16.04,因为没有界面,所以远程命令行操作.爬虫是基于Sel ...

  2. vue--mixins

    混入(mixins) 是一种分发Vue 组件中可复用功能的非常灵活的方式 mixins主要用在以下两个方面: 当做完一个项目,想好好放松的时候,突然有新需求 为了不污染完美的构造函数,在构造函数外面定 ...

  3. idea Debug快捷键

    快捷键 介绍 F7 在 Debug 模式下,进入下一步,如果当前行断点是一个方法,则进入当前方法体内, 如果该方法体还有方法,则不会进入该内嵌的方法中 * F8 在 Debug 模式下,进入下一步,如 ...

  4. 自定义Cordova插件(基础篇)

    cordova自定义插件 注意:存放自定义cordova插件目录不能有空格可能会报错 cordova的安装 下载node.js,安装完成后你可以在命令行中使用node和npm. 安装cordova使用 ...

  5. sqlite3如何判断一个表是否已经存在于数据库中 C++

    SELECT count(*) AS cnt FROM sqlite_master WHERE type='table' AND name='table_name';cnt will return 0 ...

  6. web服务器初识

    静态元素:.html .img js css swf mp4   --->浏览器自身可以解析 动态元素:.php .jsp .cgi .asp php SQL  ---->浏览器不能直接解 ...

  7. [ZJOI2019]麻将

    这是一道麻将自动机的模板题(雾 其实这是一道dp套dp借助自动机实现的麻将好题! 首先把期望转化一下,拆成sigema p(x>i) 现在要计算i张牌不胡的概率,也就等价于计算i张牌不胡的方案数 ...

  8. 微信小程序----用户拒绝授权,重新调起授权

    获取用户信息 wx.getUserInfo({ withCredentials: true, success: function (res) { var nickName = res.userInfo ...

  9. max of 直线划平面

    在一个无限延伸平面上有一个圆和n条直线,这些直线中每一条都在一个圆内,并且同其他所有的直线相交,假设没有3条直线相交于一点,试问这些直线最多将圆分成多少区域. Input 第一行包含一个整数T,(0& ...

  10. 数据库 ACID

    ACID是指一个事务本质上有四个特点: Atomicity:原子性 Consistency:一致性 Isolation:隔离性 Durablilty:耐久性 原子性 原子性是指事务是一个不可分割的工作 ...