#include<iostream>
#include<string>
#include<vector>
#include<cmath>
using namespace std;
bool zhishu_judge(unsigned num)
{
for (int i = 2; i <=sqrt(num); ++i)
{
if (num%i == 0)
return false;
}
return true;
}
vector<int> zhishu(unsigned rge)
{
vector<int> zs = { 2 };
unsigned count = 1;
for (unsigned i = 3;; ++i)
{
if (zhishu_judge(i))
{
zs.push_back(i);
++count;
}
if (count == rge)
return zs;
}
}
int main()
{
unsigned m, n;
cin >> m >> n;
vector<int> zhishu_range = zhishu(10000);
int col = 0;
for (int i = m-1; i < n; ++i)
{
if (i == (n - 1))
{
cout << zhishu_range[i];
}
else
{
if (col % 10 < 9)
{
cout << zhishu_range[i] << " ";
}
else
{
cout << zhishu_range[i] << endl;
}
}
++col;
}
system("pause");
return 0;
}
网友评论