POJ2407Relatives(欧拉函数入门题目)
#include <iostream>#include <cstdio>#include <cstring>using namespace std;//Accepted164K0MSC++472Bint work(int n) { int rea = n; for(int i = 2; i*i<=n; i++) { if(n%i == 0) { rea = rea - rea/i; while(n%i==0) { n /= i; } } } if(n>1) { rea = rea - rea/n ;} return rea;}int main(){ int n; while(scanf("%d", &n) && n) { int res = work(n); printf("%d\n", res); } return 0;}