But you want

sum (2k) for k = 1..2N

= 2 + 4+ 6 + ... + 2N

= 2( 1 + 2 + 3 + ... + N)

So, the rest should be easy to finish.

Solved

Posted on 2011-04-24

The instructor from my online course went over this but unfortunately I couldn't understand his answer due to his think accent.

What is the sum of all even numbers from 0 to 2n, for any positive integer n?

What is the sum of all even numbers from 0 to 2n, for any positive integer n?

3 Comments

But you want

sum (2k) for k = 1..2N

= 2 + 4+ 6 + ... + 2N

= 2( 1 + 2 + 3 + ... + N)

So, the rest should be easy to finish.

Here's how he most likely explained it.

Let's say S = 1+2+3+4+5+...+N

So 2S = 1+2+3+4+5+...+N + 1+2+3+4+5+...+N

Now flip one of them

So 2S = 1+ 2+ 3 + 4+5+...+N

+ N+(N-1)+(N-2). .. +1

Notice how the first one in each is N and 1, the next two are (N-1) and 2 which add to N+1

If fact, each pair equals N+1 and there are N of them.

So 2S = N(N+1) and S = N(N+1)/2

This is a common result that you will be expected to remember probably.

Title | # Comments | Views | Activity |
---|---|---|---|

is there a better algorithms for this case? | 12 | 133 | |

How to determine sequence | 8 | 82 | |

Class Structure | 3 | 95 | |

factory design pattern vs abstract factoy design pattern | 2 | 65 |

how to add IIS SMTP to handle application/Scanner relays into office 365.

Join the community of 500,000 technology professionals and ask your questions.

Connect with top rated Experts

**17** Experts available now in Live!