<s>[INST] Sum of numbers in a grouping question A person grouped numbers in the following way:
$$\left \{ 1 \right \},\left \{ 3,5 \right \},\left \{ 7,9,11 \right \},\left \{ 13,15,17,19 \right \},...$$
What is the sum of the numbers in the $9$th grouping?
I got the answer as $729$, by inspection. I wanted to try it again with a more mathematically method so here is my progress.
I noticed that the sum of the first $n$ groups containing odd numbers is $\frac{1}{2}n(n+1)$. I also know that the sum of the first $k$ odd terms is $k^{2}$. So I said to get the sum of the terms in the $n$th group, I must add sum of the numbers in the $n$th group and subtract it from the sum of the first $(n-1)$ groups. That is:
$$ [\frac{1}{2}n(n+1)]^{2} - [\frac{1}{2}n(1+(n-1))]^{2}$$
$$= \frac{1}{2}n^{3}+\frac{1}{4}n^{2}$$.
When I plugged in $n = 9$, I didn't get $729$. Where did I go wrong?
 [/INST] Use the fact that arithmetic sum of odd numbers is a square:
$$\sum_{k=1}^{n} (2k-1) = n^2$$
The sum of a grouping will therefore be the difference of two squares. Which squares? Those are also arithmetic sequence $1,2,3,4...n$ which is $a_n = n(n+1)/2$. So it should be:
${a_{n+1}}^2 - {a_n}^2 = ((n+1)(n+2)/2)^2 - (n(n+1)/2)^2 =  (n+1)^2((n+2)^2-n^2)/4 = (n+1)^2(2n+2)2/4 = (n+1)^2(n+1) = (n+1)^3$ which is $9^3 = 729$ for $n = 8$. So it seems to me you are right.
</s>