#include #include using namespace std; std::vector enum_prime(int n) // containing n { std::vector res; if (n <= 1) { return res; } std::vector p(n + 1); fill(p.begin() + 2, p.end(), true); for (int i = 2; i <= n; i++) { if (p[i]) { res.push_back(i); for (int j = i * 2; j <= n; j += i) { p[j] = false; } } } return res; } int main() { int m; cin >> m; if(!m) { m += 998244353; } vector prime = enum_prime(50000); int l = 0, r = (int)prime.size() - 1; vector ans; while (m) { for (int i = 30; i >= 0; i--) { if (m >= (1 << i) - 1) { while (prime[l] * prime[r] > 100000) { r--; } for (int j = 0; j < i; j++) { ans.push_back(prime[l] * prime[r--]); } m -= (1 << i) - 1; l++; break; } } } cout << ans.size() << endl; for (int a : ans) { cout << a << " "; } cout << endl; }