given an integer $n$, you have to find $a,b>0$ so that $a+b=n$ and $LCM(a,b)$ is maximum($LCM$ is the least common multiple of $a,b$).↵
↵
printf the maximum $LCM(a,b)$↵
↵
i have come up with a bruteforce solution. I will consider all pairs of $a,b$ that have sum equal to $n$. And calculate the value of ↵
↵
$LCM(a,b)=(a*b)/GCD(a,b)$. ($GCD$ is greatest common divisor).↵
↵
But, this solution seems too slow when $n<=10^9$. Is there a better solution for this problem ?↵
↵
↵
printf the maximum $LCM(a,b)$↵
↵
i have come up with a bruteforce solution. I will consider all pairs of $a,b$ that have sum equal to $n$. And calculate the value of ↵
↵
$LCM(a,b)=(a*b)/GCD(a,b)$. ($GCD$ is greatest common divisor).↵
↵
But, this solution seems too slow when $n<=10^9$. Is there a better solution for this problem ?↵
↵