(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 ...
随机推荐
- web压缩gzip响应
String data = "ggrgrgw4gergergregerge"; byte b[] = data.getBytes(); String gzipValue = req ...
- 模拟美萍加密狗--Rockey2虚拟狗(一)
目录(?)[+] 最近受朋友之托做了一个美萍智能电源控制的插件.美萍茶楼从2010版开始支持智能电源控制设备,就是开单.结账时自动开关相应房间的电器,不过官方的设备是有线的.朋友的店已经开了一段时 ...
- Protel99se教程六:创建原理图元件库
在我们平时使用protel99se进行电路以及PCB设计的时候,系统自带的元件库和PCB封装库,只有一小部分,大部份元件的元件库以及封装库,我们都需要自己制作,使用protel99se,我们可以很容易 ...
- Spring Boot Admin Reference Guide
1. What is Spring Boot Admin? Spring Boot Admin is a simple application to manage and monitor your S ...
- HDU 3307 Description has only two Sentences
数学实在是差到不行了…… #include <cstdio> #include <cstring> #include <algorithm> #include &l ...
- Eclipse RCP扩展
它跟普通的插件扩展点是一样的写法,你只需要看 eclipse 自带的源码,打开你的 eclipse 目录,插件 *.exsd 找到后在 eclipse 中查看这个文件夹对应的插件的源码,里面有 plu ...
- java面试题系列12
1.面向对象的特征有哪些方面 a.抽象: 抽象就是忽略一个主题中与当前目标无关的那些方面,以便更充分地注意与当前目标有关的方面.抽象并不打算了解全部问题,而只是选择其中的一部分,暂时不用部分细节.抽象 ...
- Scrambled Polygon(凸多边形,斜率)
Scrambled Polygon Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 7805 Accepted: 3712 ...
- CSDN Markdown简明教程3-表格和公式
0. 文件夹 文件夹 前言 表格 1 表格 2 表格对齐方式 公式 1 行内公式 2 陈列公式displayed formulas 3 MathJax语法 深入 声明 1. 前言 Markdown是一 ...
- 不可不知的HTML优化技巧
如何提升Web页面的性能,很多开发人员从多个方面来下手如JavaScript.图像优化.服务器配置,文件压缩或是调整CSS. 很显然HTML 已经达到了一个瓶颈,尽管它是开发Web 界面必备的核心语言 ...