对于每个p 我们分解质因数后 肯定要那么多个质因数 所以直接暴力遍历质因数的倍数让他满足最小的质因数倍数即可
#include<bits/stdc++.h>
using namespace std;
#define int long long
void solve(){
int p;cin>>p;
int res=0;
for(int i=2;i<=p/i;i++){
if(p%i==0){
int cnt=0;
while(p%i==0){
p/=i;
cnt++;
}
// i cnt
// cout<<i<<' '<<cnt<<endl;
int cnt1=0,j;
for(j=i;cnt1<cnt;){
int x=j;
while(x%i==0){
x/=i;
cnt1++;
}
if(cnt1<cnt)j+=i;
// cout<<j<<' '<<cnt1<<endl;
}
res=max(res,j);
}
}
// cout<<p<<endl;
res=max(res,p);
cout<<res<<endl;
}
signed main(){
ios::sync_with_stdio(false);cin.tie(0);
int t=1;cin>>t;
while(t--){
solve();
}
return 0;
}