You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
741 B
C++

#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned ll;
const int N = 500;
bool notPrime[N];
int main()
{
for (ll i = 2; i < N; i++)
if (!notPrime[i])
for (ll j = i * i; j < N; j += i)
notPrime[j] = true;
set<ull> s;
s.insert(1);
for (int i = 2; i < (1 << 16); i++)
{
int top = ceil(64 / log2(i));
ull t = 1;
for (int j = 1; j < top; j++)
{
t *= i;
if (notPrime[j])
s.insert(t);
}
}
for (auto x : s)
printf("%llu\n", x);
return 0;
}