#ifdef LOCAL //#define _GLIBCXX_DEBUG #endif //#pragma GCC target("avx512f,avx512dq,avx512cd,avx512bw,avx512vl") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include using namespace std; typedef long long ll; typedef long double ld; typedef pair P; typedef pair Pi; typedef vector Vec; typedef vector Vi; typedef vector Vs; typedef vector Vc; typedef vector

VP; typedef vector> VV; typedef vector> VVi; typedef vector> VVc; typedef vector>> VVV; typedef vector>>> VVVV; #define endl '\n' #define REP(i, a, b) for(ll i=(a); i<(b); i++) #define PER(i, a, b) for(ll i=(a); i>=(b); i--) #define rep(i, n) REP(i, 0, n) #define per(i, n) PER(i, n, 0) const ll INF=1e18+18; const ll MOD=1000000007; #define Yes(n) cout << ((n) ? "Yes" : "No") << endl; #define YES(n) cout << ((n) ? "YES" : "NO") << endl; #define ALL(v) v.begin(), v.end() #define rALL(v) v.rbegin(), v.rend() #define pb(x) push_back(x) #define mp(a, b) make_pair(a,b) #define Each(a,b) for(auto &a :b) #define rEach(i, mp) for (auto i = mp.rbegin(); i != mp.rend(); ++i) #ifdef LOCAL #define dbg(x_) cerr << #x_ << ":" << x_ << endl; #define dbgmap(mp) cerr << #mp << ":"<first <<":"<second << endl;} #define dbgset(st) cerr << #st << ":"<bool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (b ostream &operator<<(ostream &s, const pair &p) { return s<<"("<istream& operator>>(istream&i,vector&v) {rep(j,v.size())i>>v[j];return i;} // vector template ostream &operator<<(ostream &s, const vector &v) { int len=v.size(); for(int i=0; i ostream &operator<<(ostream &s, const vector > &vv) { s< prime_table(int n) { vector< bool > prime(n + 1, true); if(n >= 0) prime[0] = false; if(n >= 1) prime[1] = false; for(int i = 2; i * i <= n; i++) { if(!prime[i]) continue; for(int j = i + i; j <= n; j += i) { prime[j] = false; } } return prime; } int solve(){ ll K; cin>>K; vector pt = prime_table(100); ll L = 0; //ng ll R = 4e18; //ok if(K==1){ out(1); return 0; } auto f = [&](ll x)->bool{ //x以下の累乗数がK個以上 ll cnt = 1; REP(b, 2, 61){ if(!pt[b])continue; ll LL = 1;//ok ll RR = 4e18;//ng while(LL+1 < RR){ ll a = (LL+RR)/2; // a^b < x bool ok = true; ll val = 1; rep(_ , b){ if(val > INF/a){ ok = false; break; } val *= a; if(val >= x){ ok = false; break; } } if(ok){ LL = a; }else{ RR = a; } } //dbg(mp(LL,b)) cnt += LL-1; } //dbg(cnt); return cnt >= K; }; //dbg(f(50)); while(L+1 < R){ ll mid = (L+R)/2; if(f(mid)){ R = mid; }else{ L = mid; } } out(L); return 0; } int main() { cin.tie(nullptr); ios::sync_with_stdio(false); cout<>T; while(T--) solve(); }