#include using namespace std; void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); } int main() { fast_io(); const int M = 1e7 + 1; vector dp(M + 1); iota(dp.begin(), dp.end(), 0); dp[1] = 1; for (int i = 1; i <= M; i++) { for (int j = 2 * i; j <= M; j += i) { dp[j] -= dp[i]; } } vector cum(M + 1); for (int i = 1; i <= M; i++) { cum[i] = cum[i - 1] + dp[i]; } int t; cin >> t; for (; t--;) { int n; cin >> n; cout << (long long)n * (n - 1) - cum[n] + 1 << "\n"; } }