#include <iostream>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char** argv) {
long long int a;
while(cin>>a,a)
{long long int b=a;
for(int i=2;i<=a;i+=(i==2?1:2))
{if(a%i) continue;
b*=(1-1.0/i);
while(a%i==0) {a/=i;}
}
if(b==a){b--;}
cout<<b<<endl;
}
return 0;
}
請問如何改進?
http://acm.nudt.edu.cn/~twcourse/Euler'sPhiFunction.html