#include #include #include #include #include #include #include using namespace std; using ll = long long; int gcd(int n, int m) { if (n < m) swap(n, m); while (m != 0) { int r = n % m; n = m; m = r; } return n; } int main() { int t; cin >> t; for (int _ = 0; _ < t; _++) { ll n; cin >> n; ll r = 0; vector a((int)sqrt(n) + 1, 0); for (int k = 2; k * k <= n; k++) { if (a[k]) continue; int c = 0; for (int l = k; l <= n; l *= k) { a[l] = 1; c++; } for (int i = 1; i <= c; i++) { for (int j = 1; j < i; j++) { int g = gcd(i, j); int i1 = i / g, j1 = j / g; r += n / i1; } } } r *= 2; r += n * n - n + n * n; cout << r << '\n'; } return 0; }