Find pair with maximum GCD for integers in range 2 to N | Function to find the required pair whose GCD is maximum ; If N is even ; If N is odd ; Driver Code
function solve ( N ) { if ( N % 2 == 0 ) { document . write ( N / 2 + " " + N + " " ) ; } else { document . write ( ( N - 1 ) / 2 + " " + ( N - 1 ) + " " ) ; } } var N = 10 ; solve ( N ) ;