Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define cin(vec) for(auto& i : vec) cin >> i
- #define cout(vec) for(auto& i : vec) cout << i << " "; cout << "\n";
- #define read_2d(vec, n, m) for(int i = 0; i < n; i++) for(int j = 0; j < m && cin >> nums[i][j]; j++);
- #define loop(a, b, c) for(int i = a ; i < (b); i += c)
- #define ceil(n, m) ((n / m) + ( n % m ? 1 : 0))
- #define all(vec) vec.begin(),vec.end()
- #define rall(vec) vec.rbegin(),vec.rend()
- #define sz size()
- #define Pair pair <int,int>
- #define ll long long
- #define ull unsigned long long
- #define Mod 1'000'000'007
- #define INF 2000'000'000
- #define PI 3.14159
- void Code_Crush(){
- ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
- #ifndef ONLINE_JUDGE
- freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout);
- #endif
- }
- vector <bool> primes(1e6 + 1, true);
- vector <int> prime;
- void Sieve(){
- for (ll i = 2, k = 0; i <= (1e6 + 1); i++){
- if (primes[i]){
- prime.push_back(i);
- for (ll j = i * i; j <= (1e6 + 1); j += i) primes[j] = false;
- }
- }
- }
- int main(){
- Code_Crush();
- Sieve();
- int t; cin >> t;
- while(t--){
- ll d; cin >> d;
- ll first = *upper_bound(all(prime), d);
- ll second = *lower_bound(all(prime), d + first);
- cout << first * second << "\n";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement