sb找规律。 分解因数。
#include<bits/stdc++.h>
#define LL long long
#define fi first
#define se second
#define mk make_pair
using namespace std; const int N=1e6+;
const int M=+;
const int inf=0x3f3f3f3f;
const LL INF=0x3f3f3f3f3f3f3f3f;
const int mod=1e9 + ; int f[N];
bool prime[N]; void init() {
memset(prime, true, sizeof(prime));
prime[] = prime[] = false;
f[] = ;
for(int i = ; i < N; i++) {
if(!prime[i]) {
continue;
} else {
f[i] = i - ;
for(int j = i + i; j < N; j += i) {
prime[j] = false;
int now = j;
while(now % i == ) {
f[j] += f[i];
now /= i;
}
}
}
}
} int main() {
init();
int T; scanf("%d", &T);
while(T--) {
int n; scanf("%d", &n);
printf("%d\n", f[n]);
}
return ;
}
/***************
****************/