这真是一个耗CPU的运算,怪不得现在因式分解和素数查找现在都用于加密运算。

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?

def isprime(n):
    boolisprime = True
    for i in xrange(2,n):
        if n % i == 0:
            boolisprime = False
    return boolisprime

def primenumber(n):
    i = 2
    x = 1
    while True:
        if isprime(i) == True:
            print i,x
            x += 1
        if x > n:
            break
        i += 1
    return i
print primenumber(10001)

10 001st prime number的更多相关文章

  1. FZU 1649 Prime number or not米勒拉宾大素数判定方法。

    C - Prime number or not Time Limit:2000MS     Memory Limit:32768KB     64bit IO Format:%I64d & % ...

  2. [LeetCode] Prime Number of Set Bits in Binary Representation 二进制表示中的非零位个数为质数

    Given two integers L and R, find the count of numbers in the range [L, R] (inclusive) having a prime ...

  3. [Swift]LeetCode762. 二进制表示中质数个计算置位 | Prime Number of Set Bits in Binary Representation

    Given two integers L and R, find the count of numbers in the range [L, R] (inclusive) having a prime ...

  4. 762. Prime Number of Set Bits in Binary Representation二进制中有质数个1的数量

    [抄题]: Given two integers L and R, find the count of numbers in the range [L, R] (inclusive) having a ...

  5. [LeetCode] 762. Prime Number of Set Bits in Binary Representation_Easy

    Given two integers L and R, find the count of numbers in the range [L, R] (inclusive) having a prime ...

  6. [LeetCode&Python] Problem 762. Prime Number of Set Bits in Binary Representation

    Given two integers L and R, find the count of numbers in the range [L, R](inclusive) having a prime ...

  7. 题目1040:Prime Number(第k个素数)

    题目链接:http://ac.jobdu.com/problem.php?pid=1040 详解链接:https://github.com/zpfbuaa/JobduInCPlusPlus 参考代码: ...

  8. 问题 B: Prime Number

    题目描述 Output the k-th prime number. 输入 k≤10000 输出 The k-th prime number. 样例输入 10 50 样例输出 29 229 #incl ...

  9. L - Prime Number(求n内质数的个数)

    Description Write a program which reads an integer n and prints the number of prime numbers which ar ...

随机推荐

  1. selenium webdriver python 环境搭建

    1. 安装python https://www.python.org/getit/ 选择2.7版本,下载安装即可. 验证是否安装成功:打开cmd,输入"python -V",显示p ...

  2. windows下的类似grep命令findstr

    windows下的类似grep命令findstr findstr后面跟的字符串不能加引号 C:\Users\Administrator>netstat -an|findstr 10.1.151 ...

  3. 在windows下MySQLdb/MySQL-python的安装

    学习Python的时候总是遇到各种各样的问题,很多问题我也百度了很久,谷歌了很多,发现很多人也遇到这种问题:但是答案又各种不同,因人而异吧! 问题:windows系统下  安装了mysql数据库   ...

  4. WORLD PROBLEMS

    World中遇到到一些问题     1. 由于文件许可权错误,word无法完成保存操作 我的选择另存为有效,没有安装卡巴斯基8.0(Kaspersky Internet Security 8.0.0. ...

  5. Oralce新建数据库、新建远程登录用户全过程

    Oracle安装完后,其中有一个缺省的数据库,除了这个缺省的数据库外,我们还可以创建自己的数据库.     对于初学者来说,为了避免麻烦,可以用'Database Configuration Assi ...

  6. Core Services 层

    Core Services层为所有的应用程序提供基础系统服务.可能应用程序并不直接使用这些服务,但它们是系统很多部分赖以建构的基础. 高阶特性 下面的部分描述一些比较常见特性,也许您正打算让您的应用程 ...

  7. hdu 4499 Cannon(暴力)

    题目链接:hdu 4499 Cannon 题目大意:给出一个n*m的棋盘,上面已经存在了k个棋子,给出棋子的位置,然后求能够在这种棋盘上放多少个炮,要求后放置上去的炮相互之间不能攻击. 解题思路:枚举 ...

  8. Sql排名和分组排名

    在很多时候,都有排名这个功能,比如排行榜,并且还需要分页的功能,一般可以再select的时候按照某一字段 oorder by XX desc,这样limit 查找就可以得到排名信息,但是有时候是需要多 ...

  9. C#3.0 语言基础扩充

    隐含类型局部变量 var i = 5; var h = 13.4; var s = "C Sharp"; var intArr = new[] {1,2,3 }; var a = ...

  10. Mosquitto安装_Ubuntu/Debian上安装消息队列Mosquitto

    Mosquitto安装_Ubuntu/Debian上安装消息队列Mosquitto MQTT是IBM开发的一个即时通讯协议.MQTT是面向M2M和物联网的连接协议,采用轻量级发布和订阅消息传输机制.M ...