http://acm.hdu.edu.cn/showproblem.php?pid=1787
非数组形式,用于大数据
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std ;
#define INT __int64
int enlerfun( int n )
{
int tempnum = 1 ;
int i ;
for( i = 2 ; i * i <= n ; ++i )
{
if( n % i == 0 )
{
n /= i ;
tempnum *= ( i - 1 ) ;
while( n % i == 0 )
{
n /= i ;
tempnum *= i ;
}
}
}
if( n > 1 )
tempnum *= ( n - 1 ) ;
return tempnum ;
}
int main()
{
int n ;
int count ;
while( ~scanf( "%d" , &n ) && n )
{
printf( "%d\n" , n - 1 - enlerfun( n ) ) ;
}
return 0 ;
}