Is it true that if an integer $k$ can be represented as $2^a$+$2^b$+...$2^n$, where a, b ... n are the members of a finite subset of $N$, there is no other way to represent $k$ as a sum of powers of 2? how could I start to show that?
Asked
Active
Viewed 193 times
-1
-
By $N$, do you mean $\Bbb N$ and is $a = b = \dots = n$ allowed?` – Edward Evans Jun 15 '16 at 03:42
-
Hint: If $a\gt b\gt c\gt\cdots$ then your sum is $\ge 2^a$ and less than $2^{a+1}$. – André Nicolas Jun 15 '16 at 04:03
2 Answers
1
Yes it's true, otherwise your computer would not work, and you could not pot the question in this forum :) $a, b, ..., n$ are different. You just want to see the binary representation of a positive integer. To prove uniqueness, it was already shown for example at Binary expansion Unique
-
haha, i didn't even make the connection with binary! in retrospect this is extremely obvious, thanks so much :) – mc-lunar Jun 17 '16 at 03:02
1
HINT
Here is an algorithm that will give you the decomposition for any fixed integer $k$.
i = 0
while k > 0:
a[i] = k mod 2
k = k div 2
After you are done, $$k = \sum_{i=0}^{|a|} 2^{a_i}$$

gt6989b
- 54,422