Skip a number in a summation

1.4k Views Asked by At

$$\sum_{n=1}^{10} n^2$$

Returns:

$1 + 4 + 9 + 16 + 25 + 36 + 49 + 64 + 81 + 100$

and I would like it to return:

$1 + 9 + 25 + 49 + 81 + 121 + 169 + 225 + 289 + 361$

How will I go about this and, more importantly, how does it work?

2

There are 2 best solutions below

0
On BEST ANSWER

You are looking for $1^2 + 3^2 +5^2 +7^2 +9^2 +11^2+13^2+15^2+17^2 +19^2$

so whats wrong with

$$\sum_{n=0}^9(2n+1)^2$$

or

$$\sum_{n=1}^{10}(2n-1)^2$$

It's $2n$ because we are going up in twos

3
On

Yes, when it is easy, the short way is to transform the radical. Sometimes it is not possible because the argument would become too complex

There is not something like the step of a loop for ... next.

sum  0
for n = 1 to 10 step 2
    sum += n^2
next

A method without introducing a new argument is to qualify the index or to express it through a relation :

$S = \sum_{odd.n=1}^{10} n^2$

$U = \{ 1,3,...,9\}$ , $S = \sum_{n \in U} n^2 $