#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <set>
#include <queue>
#include <map>
using namespace std;
#define MAX(x,y) (((x)>(y))?(x):(y))
#define MIN(x,y) (((x)<(y))?(x):(y))
#define N 500010
#define pi acos(-1.0)
#define inf 100000000
typedef long long ll;
typedef unsigned long long ull;
int main(){
//freopen("in.txt","r",stdin);
ll n;
while(~scanf("%lld",&n)){
ll ans=n;
for(ll i=2;i*i<=n;i++){
if(n%i==0){
ll a=0;
while(n%i==0){
a++;
n/=i;
}
ans=ans+ans*a*(i-1)/i;
}
}
if (n!=1) {
ans = ans + ans*(n-1)/n;
}
printf("%lld\n",ans);
}
return 0;
}
版权声明:本文为博主原创文章,未经博主允许不得转载。
时间: 2024-12-17 18:10:59