set low to 1 and high to max ( a , b ) * n , here we have taken high as 10 ^ 18
int low = 1 , high = INT_MAX , mid ; int lcm = ( a * b ) / gcd ( a , b ) ; while ( low < high ) { mid = low + ( high - low ) / 2 ;