//#pragma GCC optimize("Ofast") #ifdef LOCAL #include "debug.h" #else #include #define debug(x...) #endif #define int ll using namespace std; typedef long long ll; typedef long double ld; typedef pair pii; #define sz(x) int((x).size()) #ifdef ONLINE_JUDGE mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); #else mt19937 rng(1000 - 7); #endif const int N = 4e4 + 7; const int M = 10; const int MOD2 = 998244353; const int MOD = 1e9 + 7; const ld eps = 1e-6; const pii dir[] = { { 0, 1 }, { 0, -1 }, { 1, 0 }, { -1, 0 } }; signed main() { #ifdef LOCAL freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif cout << fixed << setprecision(9); ios::sync_with_stdio(false), cin.tie(0), cout.tie(0); const int n = 10000; const int c = 100; vector primes, p(c + 1); for (int i = 2; i < c; i++) { if (!p[i]) { for (int j = i * i; j < c; j += i) { p[j] = 1; } primes.push_back(i); } } for (int i = c; i <= n; i += c) { fill(p.begin(), p.end(), 0); for (int x : primes) { if (x * x >= i + c) { break; } int y = ((i + x - 1) / x) * x; for (int j = y; j < min(n + 1, i + c); j += x) { p[j % c] = 1; } } for (int j = 0; j < c; j++) { if (!p[j] && i + j <= n) { primes.push_back(i + j); } } } for (int x : primes) { cout << x << endl; } return 0; }