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?
题目大意:
前六个质数是2,3,5,7,11和13,其中第6个是13.
第10001个质数是多少?
#include <stdio.h> #include <string.h> #include <ctype.h> #include <math.h> int prim(int n) { int i; for(i=2; i*i<=n; i++) { if(n%i==0) return 0; } return 1; } void solve(int n) { int i=2; int count=0; while(1) { if(prim(i)) { count++; if(count==n) break; } i++; } printf("%d\n",i); } int main() { int n=10001; solve(n); return 0; }
Answer:
|
104743 |
相关推荐
深度探索 Case 1: 1 4 3 2 5 6 1 6 5 2 3 4 Case 2: 1 2 3 8 5 6 7 4 1 2 5 8 3 4 7 6 1 4 7 6 5 8 3 2 1 6 7 4 3 8 5 2
欧拉公式求长期率的matlab...Problem 7 通过列出前六个质数:2、3、5、7、11和13,我们可以看到第6个质数是13。 什么是10,001st质数? 完成prime-finder.js中的功能。 它将接受单个参数n ,其中n是要找到的第n个素数。
基于弹性云计算集群的国际TEAM Problem 7基准问题计算方法.pdf
This book is a practical reference for industry engineers using MATLAB to solve everyday problems: learn from state-of-the-art examples in robotics, motors, detection filters, chemical processes, ...
Java An Introduction to Problem Solving and Programming 7th 第7版 英文pdf
Chapter 7. Algorithmic Expression of a Hardware System Chapter 8. Using Computers to Solve Problems Part 3 Software Tools Supporting Program Execution Chapter 9. Computer Process Manipulation by ...
Wicked Environmental Problem
The C10K problem
master page search problem viewdata js
problem13p7共4页.pdf.zip
《Approaching (Almost) Any Machine Learning Problem》
MCM 2012年 problem A problem B problem C 枪手论文
遗传算法解决背包问题 MATLAB可运行代码
Problem solving with C++
8D is a problem-solving methodology for product and process improvement. It is structured into eight disciplines, emphasizing team synergy. The team as whole is better and smarter than the quality sum...
Problem Solving with C++, Global Edition by Walter Savitch (author) (Author) Pages:1117 出版社: Pearson Education Limited; 10th edition edition (November 20, 2017) Language: English ISBN-10: ...
Problem Arrangement zoj 3777
一般学习路径是先看这本Problem Solving with C++基础书然后再看c++ prime plus,不然会比较费力。然后再去看看c++创始人Bjarne Stroustrup的那本The C++ Programming Language。 顺便说一句,看这类书还是尽量看...
On a problem of formal logic___ramsey___1928On a problem of formal logic___ramsey___1928On a problem of formal logic___ramsey___1928On a problem of formal logic___ramsey___1928On a problem of formal ...
this is the machine problem solution for operating system class