Mistake in the Algorithm Design Manual? Look at this excerpt from the Algorithm Design Manual by Skiena, 2nd Edition:



"The sum of the first $n$ even integers"? Surely, the two given versions of the sum given do not include only even numbers. Is this a mistake on the author's part, or am I missing something?
Expanding those 3 equation makes the author's statement true, i.e:

$ 1+2+3+...+n=\frac{n(i+(n-i+1))}{2}=\frac{(ni+n^2-ni+n)}{2}=\frac{n^2+n}{2}=\frac{n(n+1)}{2}=2+4+6+...+2n$

The confusing part could be the 2nd one though:

$ \sum_{i=1}^{n/2}(i+(n-1+1)) = 1/2(i+(n-i+1) \underbrace{...}_{n} i+(n-i+1) ) =  \frac{n(i+(n-i+1))}{2}$
Expanding those 3 equation makes the author's statement true, i.e:

$ 1+2+3+...+n=\frac{n(i+(n-i+1))}{2}=\frac{(ni+n^2-ni+n)}{2}=\frac{n^2+n}{2}=\frac{n(n+1)}{2}=2+4+6+...+2n$

The confusing part could be the 2nd one though:

$ \sum_{i=1}^{n/2}(i+(n-1+1)) = 1/2(i+(n-i+1) \underbrace{...}_{n} i+(n-i+1) ) =  \frac{n(i+(n-i+1))}{2}$