hdu5597GTW likes function 欧拉函数

#include<cstdio>
#include<cstring>
#include<iostream>
using namespace std ;
typedef long long ll ;
ll Euler(ll n)
{
    ll rea = n ;
    for(ll i = 2;i*i <= n;i++)
    {
        if(n%i == 0)
        rea -= rea/i ;
        while(n%i == 0)
        n/=i ;
    }
    if(n>1)
    rea-=rea/n ;
    return rea ;
}
int main()
{
    ll n , x ;
    while(~scanf("%lld%lld" ,&n , &x)){
        printf("%lld\n" , Euler(n+x+1)) ;
    }

}

你可能感兴趣的:(hdu5597GTW likes function 欧拉函数)