Let $a,b,c$ positive integer such that $a+b+c=2023$. Find the maximum of $ \operatorname{lcm}(a,b)+b\cdot c+ \operatorname{gcd}(a,c)$ where $\operatorname{lcm}$ is lower common divisor and $\operatorname{gcd}$ is the greatest common divisor.
I tried to make a program in C++ but I didn't succeed.
Intuitively, $bc$ is the most important term, so something like $(a,b,c)=(1,1011,1011)$ should be close to the optimal answer. Moreover, as long as $a$ and $b$ are coprime, $\operatorname{lcm}(a,b)=ab$, so we can make $a$ bigger without changing $a+c$ – then the part $\operatorname{lcm}(a,b)+bc$ stays constant if $a$, $b$ are coprime, and $\operatorname{gcd}(a,c)$ might get bigger. Hence an ideal candidate for the greatest value would be the tuple $(a,b,c)=(506,1011,506)$.
To prove that, let us write some rough estimates:
$$ \operatorname{lcm}(a,b) + bc+ \operatorname{gcd}(a,c) \leqslant ab+bc+\frac{a+c}{2} = (a+c)\left( b+\frac{1}{2} \right)=(a+c)(2023.5-(a+c)) $$
The RHS is quadratic function in $a+c$, so it is easy to check that the greatest value is for $a+c = 1012$ (actually for $1011.75$, but we know $a+c$ has to be an integer). This bounds our expression by $1012 \cdot 1011.5$ for any $(a,b,c)$. However, for the tuple $(506,1011,506)$ we actually have equalities everywhere in the line above. Hence this is the optimal answer.