Poj 2407
水题,纯欧拉函数模板
#include <iostream>
#include <stdio.h>
using namespace std;
long long eu(long long n)
{
long long i,ret=1;
for(i=2;i*i<=n;i++)
if(n%i==0)
{
n/=i;
ret*=i-1;
while(n%i==0)
{
ret*=i;
n/=i;
}
}
if(n>1)
ret*=n-1;
return ret;
}
int main()
{
long long n;
//freopen("in.txt","r",stdin);
while(cin>>n)
{
if(n==0)
break;
else
cout<<eu(n)<<endl;
}
return 0;
}