随手写的小程序
<code class="lang-cpp">#include "stdio.h"
#include "math.h"
#include "time.h"
#define N 10000000
int i=2;
int o;
int j;
int C;
int PM;
int PM2;
clock_t t;
int sec;
int secL;
int q[N];
int Out[N];
int main(){
t = clock();
sec = (int) t;
printf("质数表\n");
for(i=2;2*i<=n;i++){ for(j="2*i;j<=N;j+=i){" q[j]+="i;" } } for(i="0;i<=N-1;i++){" if(q<span style="font-style:italic;">==0){
printf("%i ",i);
Out[C]=i;
C++;
j++;
PM=1;
}
if(C%20==0&&C!=0&&PM==1){
PM=0;
printf("\n");
}
if(j==400){
j=0;
printf("aa\n");
}}
printf("\n");
t = clock();
secL=sec;
sec = (int) t;
printf("共计%i毫秒",(sec-secL));
printf("共计%i个数",C);
printf("\n");
while(1){
printf("输入要查询的数\n");
scanf("%d",&PM2);
if(PM2<=c){printf("此位是%i\n",out[pm2-1]);} else if(pm2="=461834)break;" } return 0; }< span></=c){printf("此位是%i\n",out[pm2-1]);}></=n;i++){></span></code>
共计1501135毫秒共计664581个数