#include #include #include using namespace std; // Exactly same as TopCoder SRM 713 Div1 Easy - PowerEquation int gcd(int x, int y) { if (y == 0) return x; return gcd(y, x % y); } int main() { cin.tie(0); ios_base::sync_with_stdio(false); int Q; cin >> Q; while (Q--) { int n; cin >> n; long long ret = 1LL * (2 * n - 1) * n; for (int i = 1; i <= 32; i++) { for (int j = 1; j <= 32; j++) { if (i + j == 2 || gcd(i, j) != 1) continue; int sum = 0, p = max(i, j); for (int k = 2; ; k++) { long long prod = 1; for (int l = 0; l < p; l++) prod *= k; if (prod > n) break; sum++; } ret = (ret + 1LL * sum * (n / p)); } } cout << ret << endl; } return 0; }