Title:
Given d, it is required to output a number x, x has at least 4 factors, and the difference between any two factors of x must be greater than or equal to d.
answer:
Play with your hands, x must be the product of 2 prime numbers. The first factor a is the smallest prime number >=1+x, and the second factor b is the smallest prime number >=1+a.
AC code:
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define lep(i,a,b) for(int i=(a);i>=(b);i--)
#define pii pair<int,int>
#define pll pair<long long,long long>
#define mp make_pair
#define All(x) x.begin(),x.end()
#define ms(a,b) memset(a,b,sizeof(a))
#define INF 0x3f3f3f3f
#define INFF 0x3f3f3f3f3f3f3f3f
#define multi int T;scanf("%d",&T);while(T--)
using namespace std;
typedef long long ll;
typedef double db;
const int N=1e6+5;
const int mod=1e9+7;
const db eps=1e-6;
const db pi=acos(-1.0);
int n,m;
int prime[N],cnt;//素数筛¸
bool vis[N];
void pr(int n)
{
ms(vis,0);
for(int i=2;i<=n;i++)
{
if(!vis[i])
{
prime[cnt++]=i;
}
for(int j=0;j<cnt&&prime[j]<=n/i;j++)
{
vis[prime[j]*i]=1;
if(i%prime[j]==0)
{
break;
}
}
}
}
int main(){
#ifndef ONLINE_JUDGE
freopen("D:\\work\\data.in","r",stdin);
#endif
pr(1000000);
multi{
cin>>n;
int posa=lower_bound(prime,prime+cnt,1+n)-prime,posb=lower_bound(prime,prime+cnt,prime[posa]+n)-prime;
cout<<prime[posa]*prime[posb]<<endl;
}
}