python program for the above approach
import math NEW_LINE def Euler_totient_function ( n ) : NEW_LINE INDENT result = 1 NEW_LINE for i in range ( 2 , n + 1 ) : NEW_LINE INDENT c = 0 NEW_LINE if n % i == 0 : NEW_LINE INDENT while ( n % i == 0 ) : NEW_LINE INDENT c += 1 NEW_LINE n //= i NEW_LINE DEDENT DEDENT if ( c > 0 ) : NEW_LINE INDENT power = math . pow ( i , c - 1 ) NEW_LINE m = math . pow ( i , c - 1 ) * ( i - 1 ) NEW_LINE result *= m NEW_LINE DEDENT DEDENT if ( n > 1 ) : NEW_LINE INDENT result *= ( n - 1 ) NEW_LINE DEDENT return int ( result ) NEW_LINE DEDENT