(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?
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <math.h> int prim(int n)
{
int i;
for(i=; i*i<=n; i++)
{
if(n%i==)
return ;
}
return ;
} void solve(int n)
{
int i=;
int count=;
while()
{
if(prim(i))
{
count++;
if(count==n)
break;
}
i++;
}
printf("%d\n",i);
} int main()
{
int n=;
solve(n);
return ;
}
Answer:
|
25164150 |
(Problem 7)10001st prime的更多相关文章
- (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 ...
- (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 ...
- (Problem 49)Prime permutations
The arithmetic sequence, 1487, 4817, 8147, in which each of the terms increases by 3330, is unusual ...
- (Problem 70)Totient permutation
Euler's Totient function, φ(n) [sometimes called the phi function], is used to determine the number ...
- (Problem 46)Goldbach's other conjecture
It was proposed by Christian Goldbach that every odd composite number can be written as the sum of a ...
- (Problem 47)Distinct primes factors
The first two consecutive numbers to have two distinct prime factors are: 14 = 2 7 15 = 3 5 The fi ...
- (Problem 37)Truncatable primes
The number 3797 has an interesting property. Being prime itself, it is possible to continuously remo ...
- (Problem 35)Circular primes
The number, 197, is called a circular prime because all rotations of the digits: 197, 971, and 719, ...
- (Problem 73)Counting fractions in a range
Consider the fraction, n/d, where n and d are positive integers. If nd and HCF(n,d)=1, it is called ...
随机推荐
- Java 多线程 socket 取款例子 runnable callable
socket部分参考 http://blog.csdn.net/kongxx/article/details/7259465 取款部分参考 http://blog.csdn.net/dayday198 ...
- js+jquery+css3
(原生js+jquery+css3) 前言 项目需求要弄个瀑布流的页面,用的是waterfall这个插件,感觉还是可以的,项目赶就没自己的动手写.最近闲来没事,就自己写个.大致思路理清楚,还是挺好实现 ...
- 深入剖析哪些服务是Oracle 11g必须开启的
这篇文章主要介绍了哪些服务是Oracle 11g必须开启的以及这些服务的详细介绍,需要的朋友可以参考下 成功安装Oracle 11g数据库后,你会发现自己电脑运行速度会变慢,配置较低的电脑甚至出现 ...
- activemq在windows下启动报错,闪退问题
查验了网上各种方法,都没搞定,最后楼主决定按照linux的解决套路来,把windows计算机名称改为纯英文字母,原计算机名:lee_pc,修改后为leepc,然后重启电脑,再重新运行activemq. ...
- ddraw 视频下画图 不闪烁的方法
我们如果是在在RGB视频上画图(直线,矩形等),一般采用双缓冲区继续,使用内存MemoryDC,来实现画的图形在视频上显示不闪烁的功能,但是我们知道用RGB显示视频都是使用GDI进行渲染,这样很耗CP ...
- linux使用技巧(shell/vi/screen)
1,Shell bash > awk '{print {NF}}' file 此时想修改操作命令可参照下面快捷方式 ctrl a 光标移动到命令最前面 ctrl e 光标移动到命令最后面 ctr ...
- hdu4336 Card Collector 状态压缩dp
Card Collector Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Tota ...
- Linux 内核的编译系统
Linux 的编译使用 GNU make 工具来检查整个系统的文件和调用 gcc 工具以及脚本完毕编译源码生成 image 等操作.要了解整个编译系统,我们首先要了解 Linux 内核的 Makef ...
- poj1201 Intervals【差分约束+SPFA】
转载请注明出处,谢谢:http://www.cnblogs.com/KirisameMarisa/p/4303365.html ---by 墨染之樱花 题目链接:http://poj.org/pr ...
- 裸机代码(uboot) : clear bss
一. bss介绍: 代码中函数.变量.常量 / bss段.data段.text段 /sct文件..map文件的关系[实例分析arm代码(mdk)] bss和data的区别: 全局的未初始化变量存在于. ...