#include #include #include using namespace std; long long gcd(long long a, long long b) { while (a != 0) { long long c = a; a = b%a; b = c; } return (b<0) ? -b : +b; } #define MAX (1LL<<28) bitset *composite = 0; int main() { composite = new bitset; for (long long n=2; n*ntest(n)) { for (long long m=2*n; mset(m); } } } long long u=1; long long n=0; for (long long m=1;; m++) { for (long long k=1; k=MAX) { return 0; } if (!composite->test(t)) { break; } if (w==u) { u++; p = u*m+k; } } if (p) { cout << ++n << ' ' << p << endl; } } } } return 0; }