#include "math.h"
#include "stdio.h"
/**//* × ′ó êyoí× D êy£ ìkissrat′ó 2 μ aóD′ üó a·¨*/
void main(){
long m,m1,i,k;
for(m=100000002;m<=100001000;m+=6){
m1=m-1;
k=sqrt(m1);
for (i=3;i<=k;i+=2)if(m1%i==0) break;
if(i>k){
printf("%ld is a prime\n",m1);
break;
}
m1=m+1;
k=sqrt(m1);
for (i=3;i<=k;i+=2)if(m1%i==0) break;
if(i>k){
printf("%ld is a prime\n",m1);
break;
}
}
for(m=999999998;m>=999999000;m-=6){
m1=m+1;
k=sqrt(m1);
for (i=3;i<=k;i+=2)if(m1%i==0) break;
if(i>k){
printf("%ld is a prime\n",m1);
break;
}
m1=m-1;
k=sqrt(m1);
for (i=3;i<=k;i+=2)if(m1%i==0) break;
if(i>k){
printf("%ld is a prime\n",m1);
break;
}
}
}
#include "stdio.h"
/**//* × ′ó êyoí× D êy£ ìkissrat′ó 2 μ aóD′ üó a·¨*/
void main(){
long m,m1,i,k;
for(m=100000002;m<=100001000;m+=6){
m1=m-1;
k=sqrt(m1);
for (i=3;i<=k;i+=2)if(m1%i==0) break;
if(i>k){
printf("%ld is a prime\n",m1);
break;
}
m1=m+1;
k=sqrt(m1);
for (i=3;i<=k;i+=2)if(m1%i==0) break;
if(i>k){
printf("%ld is a prime\n",m1);
break;
}
}
for(m=999999998;m>=999999000;m-=6){
m1=m+1;
k=sqrt(m1);
for (i=3;i<=k;i+=2)if(m1%i==0) break;
if(i>k){
printf("%ld is a prime\n",m1);
break;
}
m1=m-1;
k=sqrt(m1);
for (i=3;i<=k;i+=2)if(m1%i==0) break;
if(i>k){
printf("%ld is a prime\n",m1);
break;
}
}
}