#include using namespace std; template inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } using ll = long long; using P = pair; const long double PI = acos(-1.0L); ll GCD(ll a, ll b) { return b?GCD(b, a%b):a; } ll LCM(ll a, ll b) { return a/GCD(a, b)*b; } int t; int main() { cin >> t; while(t--) { ll n; cin >> n; ll ans = n*n; // a=c=1のときb,dはどの組み合わせでもよい if(n == 1) { cout << ans << endl; continue; } ll limit = sqrtl(n); vector num(n+1, true); num[0] = false; num[1] = false; for(ll i = 2; i <= limit; ++i) { // a = i if(num[i]) { ll cnt = 1; ll now = i; while(1) { if(now*i > n) break; now *= i; cnt++; } for(ll j = 1; j <= cnt; ++j) { // a = i^j ll a = powl(i, j); num[a] = false; for(ll k = j; k <= cnt; ++k) { // cout << "a=" << a << " c=" << powl(i, k) << endl; if(k == j) ans += n; else ans += ((n/k)*2); } } } } for(ll i = limit+1; i <= n; ++i) if(num[i]) ans += n; cout << ans << endl; } }