#include<iostream>
#include<cmath>
using namespace std;
int main(void)
{
for(int i=1001;i<10000;i++)
{
int count=0;
for(int j=2;j<=sqrt(i);j++)
{
if(i%j==0)
{
count++;
}
}
if(count==0)
{
cout<<i<<" ";
}
}
cout<<"Hello world"<<endl;
return 0;
}
//用while循環實現素數查找
int i=1000;
int line=0;//設置使得沒輸出5個素數就換行
while(i<10000)
{
int count=0;
int j=2;
while(j<=sqrt(i))
{
if(i%j==0)
{
count++;
}
j++;
}
if(count==0)
{
line++;
cout<<i<<" ";
if(line%5==0)//設置使得沒輸出5個素數就換行
{
cout<<endl;
}
}
i++;
}