#include <iostream>
using namespace std;
bool is_prime(int x)
{
if (x < 2) return 0;
for (int i = 2; i <= x / i; i++)
if (x % i == 0)
return 0;
return 1;
}
int main()
{
int n;
while (cin >> n)
{
bool st = 0;
for (int i = 11; i < n; i ++)
if (is_prime(i) && i % 10 == 1)
{
cout << i << ' ';
st = 1;
}
if (!st) cout << "-1 ";
puts("");
}
return 0;
}
3526. 素数
最新推荐文章于 2024-07-25 11:27:31 发布