#include using namespace std; const int MAX = 10'000'000; long long phi[MAX + 1]; int main() { ios::sync_with_stdio(false); cin.tie(0); iota(phi, phi + MAX + 1, 0); phi[1] = 0; for (int i = 2; i <= MAX; ++i) { if (phi[i] == i) for (int j = 1; i * j <= MAX; ++j) phi[i * j] -= phi[i * j] / i; phi[i] = 2 * (i - 1) - phi[i]; phi[i] += phi[i - 1]; } int T; cin >> T; while (T--) { int N; cin >> N; cout << phi[N] << '\n'; } }