#include using namespace std; #define fast_io ios::sync_with_stdio(false); cin.tie(nullptr); #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math") #define rep(i,n) for(int i = 0; i < n; i++) const long long MOD = 1000000007; vector calc_totient(long long M){ vector phi; rep(i,M+1){ phi.push_back(i); } for (int i = 2; i <= M; i++){ if (phi[i] == i){ for (int j = i; j <= M; j+=i){ phi[j] = phi[j] / i * (i-1); } } } return phi; } int main() { fast_io long long M = 10000000; vector phi = calc_totient(M); for(int i = 1; i <= M; i++){ phi[i] += phi[i-1]; } int t; cin >> t; rep(i, t){ long long n; cin >> n; long long ans = 0; ans = -phi[n] + n*(n-1) + 1; cout << ans << endl; } }