<s>[INST] A combinatorics and algebra problem I'm given two numbers $n$ and $m$. I have to make $n$ with $m$ numbers (only taking their sum). For example, if $n=6$, $m=3$, $6$ is formed with $3$ numbers in the following 
way:


*

*$1+1+4=6$

*$2+2+2=6$

*$1+2+3=6$


For every element of the sets above, if I use $C(r,2)$, $0<r<n$ and take their summation I get like this.


*

*$C(1,2)+C(1,2)+C(4,2)=0+0+6=6$

*$C(2,2)+C(2,2)+C(2,2)=3$

*$C(1,2)+C(2,2)+C(3,2)=4$


Here,we have considered $C(1,2)=0$.
One of my friend said to me that 
if we make $n$ with $m-1$ 1's plus $n-(m-1)$ then the sum of $C(r,2)$ will be maximum. In other words, the sum of $C(r,2)$ with $m-1$ 1's plus $n-(m-1)$ is always 
greater than the rest sums of $C(r,2)$.
In the above exapmle, $6$ is greater than $3$ and $4$. 
My question is that why such a occurence happens? What is the reasoning behind it?
 [/INST] It suffices to consider two summands $a,b$ and verify that $C(a,2)+C(b,2)<C(1,2)+C(a+b-1,2)$ whenever $a,b>1$. Indeed, 
$$ C(a,2)+C(b,2) = \frac12(a^2-a+b^2-b)$$
$$ C(1,2)+C(a+b-1,2) = \frac12(a+b-1)(a+b-2)$$
and the difference is after simplification
$$C(1,2)+C(a+b-1,2) -(C(a,2)+C(b,2)) = \frac12(ab-a-b+1)=\frac12(a-1)(b-1)>0$$
</s>