Maximum possible GCD for a pair of integers with sum N | Function to find the required GCD value ; If i is a factor of N ; Return the largest factor possible ; If N is a prime number ; Driver Code
def maxGCD ( N ) : NEW_LINE INDENT i = 2 NEW_LINE while ( i * i <= N ) : NEW_LINE INDENT if ( N % i == 0 ) : NEW_LINE INDENT return N // i NEW_LINE DEDENT i += 1 NEW_LINE DEDENT return 1 NEW_LINE DEDENT N = 33 NEW_LINE print ( " Maximum ▁ Possible ▁ GCD ▁ value ▁ is ▁ : ▁ " , maxGCD ( N ) ) NEW_LINE