#include using namespace std; using ll = long long; int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); const int mx = 1e7; vector isp(mx+1,0); vector cnt(mx+1,1); vector now(mx+1,0); vector ans(mx+1,0); vector all(mx+1,0); ans[2] = 1; for(int i = 2;i<=mx;i++){ if(isp[i]==0){ for(int j = i;j<=mx;j+=i){ isp[j] = 1; ll use = i * i; if(j%use!=0) cnt[j] *= -1; else cnt[j] *= 0; } } if(cnt[i]==0) continue; for(int j = i;j<=mx;j+=i){ ll res = j / i; now[j] += res * cnt[i]; } } for(int j = 3;j<=mx;j++){ now[j] += j; ans[j] = ans[j-1]; ans[j] += now[j]; now[j] = j - 1 - now[j]; ans[j] += 2 * now[j]; } int t; cin>>t; while(t--){ int n; cin>>n; cout<