English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

What is the equation to get the sum of the first "n" powers of 2?

2007-10-15 16:16:55 · 1 answers · asked by Nesting 2 in Science & Mathematics Mathematics

ok, 2^n-2 didn't work because if n=4
2^0 + 2^1 +2^2 + 2^3 = 15
1 + 2 + 4 + 8 = 15
3 + 12 = 15
15 = 15
and
(2^4)-2 = 14
(2^5)-2 = 30 and the above equation would equal 31
so could the equation be (2^n)-1?

2007-10-15 16:50:34 · update #1

1 answers

2^n - 2

Edit:
oops, that's what I get for trying to do it in my head. Plus I was starting with n = 1 not n = 0 as the first n.

it's easiest to think of the sum as a binary number with n ones.
x = 1111 (in binary) = 2^0 + 2^1 +2^2 + 2^3
add 1
x + 1 = 10000 ( in binary) = 2^4
x = 2^4 - 1

The number of ones in the binary number will be n. adding one to this number gives you 1 followed by n zeroes. The method above will work for any n.

In general x = 2^n - 1 as you guessed

Starting with n = 1 would mean you skip the first term which is always 1. That's where I got the 2^n - 2 formula from (one less than the other formula). But this is wrong. Skipping the first n means it should be 2^(n+1) - 2 because you are adding a term on the end to replace the term that was at the beginning (so that you still have n terms).

2007-10-15 16:36:19 · answer #1 · answered by Demiurge42 7 · 0 0

fedest.com, questions and answers