#include using namespace std; #define REP(i,a,n) for(int i=(a); i<(int)(n); i++) #define rep(i,n) REP(i,0,n) #define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it) #define ALLOF(c) (c).begin(), (c).end() typedef long long ll; typedef unsigned long long ull; ll solve(ll N){ ll ret = N*N + (N*N-N); ll sum = 0; for(ll a = 2; a<=sqrt(N); a++){ ll x = (ll)(log(N)/log(a)); ll y = (x-1) * (N/x); sum += y; } ret += 2*sum; return ret; } int main(){ int T; cin >> T; while(T--){ ll N; cin >> N; cout << solve(N) << endl; } return 0; }