Check if Euler Totient Function is same for a given number and twice of that number | Function to find the Euler 's Totient Function ; Initialize result as N ; Consider all prime factors of n and subtract their multiples from result ; Return the count ; Function to check if phi ( n ) is equals phi ( 2 * n ) ; Driver Code
def phi ( n ) : NEW_LINE INDENT result = 1 NEW_LINE for p in range ( 2 , n ) : NEW_LINE INDENT if ( __gcd ( p , n ) == 1 ) : NEW_LINE INDENT result += 1 NEW_LINE DEDENT DEDENT return result NEW_LINE DEDENT def sameEulerTotient ( n ) : NEW_LINE INDENT return phi ( n ) == phi ( 2 * n ) NEW_LINE DEDENT def __gcd ( a , b ) : NEW_LINE INDENT return a if b == 0 else __gcd ( b , a % b ) NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT N = 13 NEW_LINE if ( sameEulerTotient ( N ) ) : NEW_LINE INDENT print ( " Yes " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " No " ) NEW_LINE DEDENT DEDENT