#include using namespace std; using ll = long long; #ifdef LOCAL #include "debug.hpp" #define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__) #else #define debug(...) #endif ll K; set st; vector v; void calc_init() { for (ll i = 3; i < 62; i++) { for (ll j = 2; j <= 1e6; j++) { double t = pow(j, i); if (t > 1e18) break; ll x = pow(j, i); ll sq = sqrt(x); if ((sq + 1) * (sq + 1) <= x) sq++; if (sq * sq > x) sq--; if (sq * sq != x) { st.insert(x); if (x < 100) debug(x); } } } for (auto x: st) v.push_back(x); } bool isOK(ll key) { ll max = sqrt(key); if ((max + 1) * (max + 1) <= key) max++; if (max * max > key) max--; ll l = upper_bound(v.begin(), v.end(), key) - v.begin(); ll cnt = max + l; return (cnt >= K); } int main() { ios::sync_with_stdio(false); cin.tie(0); calc_init(); ll T; cin >> T; for (ll t = 0; t < T; t++) { cin >> K; // N以下の累乗数はK個以下? ll ok = 2e18, ng = 0; while (abs(ok - ng) > 1) { ll mid = (ok + ng) / 2; if (isOK(mid)) ok = mid; else ng = mid; } cout << ok << '\n'; } return 0; }