For partitioning into two numbers the product is maximized when the two variables are closest to one another:
$$g(n) \equiv \mathrm{max} \{ xy : x + y = n\} = \left\{ \begin{array}{clll}
\frac{n}{2}\cdot \frac{n}{2} &=& \frac{n^2}{4} & \text{even} \\
\frac{ n-1}{2 }\cdot \frac{ n+1}{2 } &=& \frac{ n^2-1}{4 }& \text{odd}
\end{array}\right. $$ This is called convexity.
Since we are looking for LCM and not product, call that result $f(n)$.
In the even case, we should be careful that $\mathrm{LCM}(n,n) = n$ so we need to find the next best one:
$$\left(\frac{n}{2} -1 \right)\cdot \left(\frac{n}{2} +1\right)= \frac{n^2}{4}-1$$
Two consecutive numbers will have an LCM of at most 2.
In the odd case, two consecutive numbers will be relatively prime.
- f(9) = 4*5 = 20
- f(8) = 3*5 = 15
- f(10) = 3*7 = 21
Here's a draft answer:
$$f(n) \equiv \mathrm{max} \{ xy : x + y = n\} = \left\{ \begin{array}{cr}
\frac{n^2}{4}-1 & 0 \mod 4 \\
\frac{n^2}{4}-4 & 2 \mod 4 \\
\frac{ n^2-1}{4 }& 1,3 \mod 4 \end{array}\right. $$
Because the integers are discrete, and the irregularities of the LCM, you have to make all sorts of corrections.
- for small $n$ this is certainly wrong
- the answer seems to depend on the factors of $\frac{n}{2}$ for even values of $n$
You may not want to follow this logic to several variables - and there may be a slicker totally different way. At least we can see some of the continuity of the numbers you are generating.