human
Find the pair ( a , b ) with minimum LCM such that their sum is equal to N | Function to check if number is prime or not.
As 1 is neither prime nor composite return false.
Check if it is divided by any number then it is not prime , return false.
Check if n is not divided by any number then it is prime and hence return true.
Function to find the pair ( a , b ) such that sum is N & LCM is minimum.
Check if the number is prime.
Now , if it is not prime then find the least divisior.
Check if divides n then it is a factor.
Required output is a = n / i & b = n / i * ( n - 1 ).
Driver Code.
Function call"
Solution in Python:
assistant
#Here is code to find the pair ( a , b ) with minimum LCM such that their sum is equal to N and the other steps required.
 def prime ( n ) :
	if ( n == 1 ) :
		return False
	for i in range ( 2 , n + 1 ) :
		if i * i > n :
			break
		if ( n % i == 0 ) :
			return False
	return True
def minDivisior ( n ) :
	if ( prime ( n ) ) :
		print ( 1 , n - 1 )
	else :
		for i in range ( 2 , n + 1 ) :
			if i * i > n :
				break
			if ( n % i == 0 ) :
				print ( n // i , n // i * ( i - 1 ) )
				break
N = 4
minDivisior ( N )