#define _USE_MATH_DEFINES #include using namespace std; constexpr long long N = 100000; signed main() { ios::sync_with_stdio(false); cin.tie(0); auto solve = [&] () -> long long { long long n; cin >> n; long long one = max(0LL, n - N); vector ok(N + 10, true); vector> p(35, vector(35)); long long ans = n * n; for (long long x = 2; x <= min(n, N); x++) if (ok[x]) { int cnt = 0; long long y = x; while (y <= n) { cnt++; if (y <= N) ok[y] = false; else one--; y *= x; } for (int i = 1; i <= cnt; i++) for (int j = 1; j <= cnt; j++) { p[i][j]++; } } p[1][1] += one; for (int i = 1; i < 35; i++) for (int j = 1; j < 35; j++) { int g = __gcd(i, j); int k = max(i, j) / g; ans += p[i][j] * (n / k); } return ans; }; int t; cin >> t; while (t--) cout << solve() << '\n'; return 0; }