#include #include using namespace std; using namespace atcoder; using ll=int; using ld=long double; ld pie=3.14159265359; ll inf=1001000000; ll mod=1000000007; int64_t euler_phi(int64_t n) { int64_t ret = n; for(int64_t i = 2; i * i <= n; i++) { if(n % i == 0) { ret -= ret / i; while(n % i == 0) n /= i; } } if(n > 1) ret -= ret / n; return ret; } int main(){ ll t; cin >> t; vectorans(10000005,0); ans[2]=1; for (ll i = 3; i < ans.size(); i++) { ll x=euler_phi(i); ans[i]=ans[i-1]+x+(i-1-x)*2; } for (ll o = 0; o < t; o++) { ll n; cin >> n; cout << ans[n] << endl; } }