2

Is there a generalized formula for finding a sum such as this one? I'm going over an old quiz for a programming class but I'm not able to solve it:

$$ \sum_{n=5}^{204} (n - 2) $$

I know this is probably dead simple, but I'm seriously lacking on the math side of computer science.

Start wearing purple
  • 53,234
  • 13
  • 164
  • 223

4 Answers4

7

Hint:

$$ \sum_{i=1}^{n}i = \frac{n(n+1)}{2}, \quad \sum_{i=1}^{n}1 = n.$$

MJD
  • 65,394
  • 39
  • 298
  • 580
4

$$\sum_{n=5-4}^{204-4}((n+4)-2)=\sum_{n=1}^{200}(n+2)=\frac{200.(200+1)}{2}+2.200=20500$$

Ömer
  • 2,038
3

The other answers mention that you require the sum $\sum_{1}^{k} n=\frac{k(k+1)}{2}$. It is also useful to note that $$\sum_{n=5}^{204}(n-2)=\sum_{n=3}^{202}n$$ This is called shifting the index, and to convince yourself it works you can just write out the first few terms of each side.

2

the only thing that you have to kcon is that : $$ \sum_{k=0}^{n} k = \frac{n(n+1)}{2} $$

JaCkO91
  • 388