#include <iostream>
#include <cmath>
using namespace std;
int jisuan(int x)
{
int i,res=x;
for(i=2;i<(int)sqrt(x*1.0)+1;i++)
if(x%i==0)
{
res=res/i*(i-1);
while(x%i==0)
x/=i;
}
if(x>1)
res=res/x*(x-1);
return res;
}
int main(void)
{
unsigned __int64 n;
while(scanf("%I64d", &n), n)
{
unsigned __int64 sum = n * (n + 1) / 2 - n, res;
res = sum - (n * jisuan(n) / 2);
printf("%I64d\n", res % 1000000007);
}
return 0;
}
05-23
05-23
05-23
05-23
05-23
05-23
05-23
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交