<s>[INST] the sum of consecutive odd numbers If the sum of consecutive odd numbers starting with $-3$ until $2k+1$ equals $21$
What is the value of $k$ ?
I can solve this by trying the numbers $-3-1+1+3+5+7+9=21$ , so the last term is $7th$ so the $k$ value is $3$
But I could not solve this with formula, I know the odd numbers come in the form of $2k+1$ but could not get much further.
 [/INST] Notice that
$$\begin{align}1^2&=1\\2^2&=1+3\\3^2&=1+3+5\\\vdots&\qquad\qquad\qquad\quad\ddots\\k^2&=1+3+5+\dots+(2k-1)\\(k+1)^2&=1+3+5+\dots+(2k-1)+(2k+1)\end{align}$$
Thus,
$$-3-1+1+3+\dots+(2k+1)=(k+1)^2-4$$
</s>