请看这个说明http://blog.csdn.net/u014800748/article/details/45914353
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
#define _CRT_SECURE_NO_WARNINGS #include<iostream> #include<algorithm> #include<set> #include<vector> #include<queue> #include<cstdlib> #include<cstdio> #include<cstring> #include<cmath> using namespace std; typedef long long LL; typedef unsigned long long ULL; bool vis[100]; set<ULL>s; int main() { int prime[] = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61 }; for (int i = 0; i < 18; i++) vis[prime[i]] = 1; ULL lim = ~0LL >> 1; s.clear(); for (ULL i = 2;; ++i){ ULL cnt = -1, x = lim; while (x){ x /= i; cnt++; } if (cnt < 4)break; ULL b = i; for (ULL j = 2; j <= cnt; ++j){ b *= i; if (!vis[j]) s.insert(b); } } s.insert(1); set<ULL>::iterator it; for (it = s.begin(); it != s.end(); it++) cout << *it << ' '; return 0; }