# include <stdio.h>
# include <math.h>
int Is_SuShu(int n);
int main () {
int m,n,i,count = 0,count1 = 0;
int zhishu[105000];
scanf("%d %d",&m,&n);
for (i = 2; i <= 105000; i++)
{
if(Is_SuShu(i))
{
count++;
if (count<=n&&count>=m)
{
count1++;
if(count1!=n-m+1)
{
if (count1 % 10!=0)
printf("%d ",i);
else
printf("%d\n",i);
}
if(count1==n-m+1)
printf("%d",i);
}
}
}
// printf("%d",count);
return 0;
}
int Is_SuShu(int n)
{
int j,s;
s = sqrt(n);
for (j = 2; j <= s; j++)
{
if (n % j == 0)
return 0;
}
return 1;
}
PAT1012
最新推荐文章于 2024-11-17 09:45:06 发布