#include #include #define MAX (long long int)1e18 int check[110]; std::vector prime; long long int func(int k, int mul,long long int val) { if(mul>60) return 0; if(k==prime.size()) { if(mul==1) return 0; long long int min = 1, max = val; long long int p = 1; while(min<=max) { long long int h = (min+max)/2; long long int t = val; for(int i=1;i<=mul;i++) t/=h; if(t==0) max = h-1; else { p = h; min = h+1; } } return p-1; } long long int s1 = func(k+1,mul,val); long long int s2 = func(k+1,mul*prime[k],val); return s1-s2; } int main() { for(int i=2;i<=60;i++) { if(check[i]==0) { prime.push_back(i); for(int j=i;j<=60;j+=i) check[j] = 1; } } int T; scanf("%d",&T); while(T--) { int a; scanf("%d",&a); long long int min = 1, max = MAX; long long int ans = MAX; while(min<=max) { long long int h = (min+max)/2; long long int s = -func(0,1,h)+1; if(s>=a) { ans = h; max = h-1; } else min = h+1; } printf("%lld\n",ans); } }