#include int main () { int t = 0; int n = 0; int res = 0; long long sum[10000001] = {}; int rem[10000001] = {}; for (int i = 2; i <= 10000000; i++) { sum[i] = 1LL; rem[i] = i; } for (int i = 2; i <= 10000000; i++) { if (rem[i] > 1) { sum[i] = (long long)(i-1); for (int j = 2; i*j <= 10000000; j++) { sum[i*j] *= (long long)(i-1); rem[i*j] /= i; while (rem[i*j]%i == 0) { sum[i*j] *= (long long)i; rem[i*j] /= i; } } } sum[i] += sum[i-1]; } res = scanf("%d", &t); while (t > 0) { long long ans = 0LL; res = scanf("%d", &n); ans = (long long)n; ans *= (long long)(n-1); ans -= sum[n]; printf("%lld\n", ans); t--; } return 0; }