【题目描述】
意思就是求sigma(gcd(i,n)),其中1<=i<=n
【解题思路】
ll d[500005];
int main()
{
ll i, j, index = 0;
for (i = 0; i < 100000; ++i) {
if (isPrime(i)) {
d[index++] = i;
}
}
ll n;
while (scanf("%lld", &n) == 1) {
ll ans = 1;
for (i = 0; i < index; ++i) {
ll tmp = 1, sum = 0;
if (d[i] > n) break;
while (n % d[i] == 0) {
n /= d[i];
tmp *= d[i];
++sum;
if (n == 1) break;
}
if (tmp != 1) {
ans *= (sum + 1) * tmp -+ sum * (tmp / d[i]);
}
}
if (n != 1) ans *= 2 * n - 1;
printf("%lld\n", ans);
}
return 0;
}