Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdio>
- int q[100000004];
- int p[100000004];
- int main(){
- int a,b,c;
- for(a=2;a<100000;a++){
- if(q[a]==0){
- for(b=a+1;b<100000;b++){
- for(c=0;c<a && b<100000;b++){
- if(q[b]==0){
- c++;
- }
- }
- b--;
- q[b]=1;
- }
- }
- }
- for(a=2,c=0;a<100000;a++){
- if(q[a]==0){
- p[c]=a;
- c++;
- }
- }
- while(scanf("%d",&a) && a!=0){
- printf("%d\n",p[a-1]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement