Advertisement
O_Egor

15

May 25th, 2022 (edited)
631
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <vector>
  3. #include <cmath>
  4. #include <map>
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.  
  10.     vector<char> prime(2532160 + 1, true);
  11.     prime[0] = prime[1] = false;
  12.     for (int i = 2; i <= 2532160; ++i)
  13.         if (prime[i])
  14.             if (i * 1ll * i <= 2532160)
  15.                 for (int j = i * i; j <= 2532160; j += i)
  16.                     prime[j] = false;
  17.  
  18.     vector <int> v;
  19.     for (int i = 2532000; i < 2532160 + 1; ++i)
  20.     {
  21.         if (prime[i])
  22.         {
  23.             v.push_back(i);
  24.         }
  25.     }
  26.     for (int i = 0; i < v.size(); i += 3)
  27.     {
  28.         cout << i + 1 << ' ' << v[i] << '\n';
  29.     }
  30.     return 0;
  31. }
Advertisement
RAW Paste Data Copied
Advertisement