(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 ...
随机推荐
- PROTEL 99SE的打印设置
现在市面上关于PTROTEL99SE的书很多,但都没有具体叙述有关电路图的打印设置方法.PROTEL99SE的打印设置较之以前的版本有了很多不同之处.特别是在实际做电路板时有些细节须注意. 原理图的打 ...
- hdoj 1878 欧拉回路(无向图欧拉回路+并查集)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1878 思路分析:该问题给定一个无向图,要求判断该无向图是否存在欧拉回路:无向图判断存在欧拉回路的两个必 ...
- config.json ajenti
{ "users": { "root": { "configs": { ...
- Linux BFS简介
1. 什么是BFS 这里的BFS可不是广度优先算法,本文介绍的BFS是Linux的一个非Linux mainline调度算法.根据作者的描述BFS能够极大的提高低端设备(这里的低端设备的定义为:CPU ...
- Shortest Prefixes(trie树唯一标识)
Shortest Prefixes Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 15948 Accepted: 688 ...
- [置顶] c++播放Flash文件
最近由于需要在程序中使用Flash播放,所以学习了下如何播放Flash,这里使用atl库中的CAxWindow来处理我们要播放的Flash!由于Flash的很多接口我们都不知道,所以可以参考前一篇文章 ...
- Java自定义简单标签
Java自定义简单标签可以方便的在页面输出信息,并且对于权限的控制,和对于Jsp标签和servlet代码的分离有着很好的作用. 下面将以权限的控制为例自定义一个标签: 一.标签类型 <wxt: ...
- ubuntu之安装java浏览器插件
最近搞什么openstack,在浏览器访问远程虚拟机的时候,需要浏览器有支持java.这个之前真没注意过呢, 通过自己的实践写点东西,方便一下你们搞: 1,首先去http://www.java.com ...
- NOIP2014解题报告
day 1 1.生活大爆炸版石头剪刀布(rps) 直接按照题意模拟即可 #include<cstdio> #include<algorithm> #include<cst ...
- 在VS2010上使用C#调用非托管C++生成的DLL文件
背景 在项目过程中,有时候你需要调用非C#编写的DLL文件,尤其在使用一些第三方通讯组件的时候,通过C#来开发应用软件时,就需要利用DllImport特性进行方法调用.本篇文章将引导你快速理解这个调用 ...