Every positive integer can be expressed in a unique way as the sum of powers of 2. Express 2008 as the sum of powers of 2.

Printable View

- October 13th 2008, 08:34 AMnancymcwilliamsinterger problem
Every positive integer can be expressed in a unique way as the sum of powers of 2. Express 2008 as the sum of powers of 2.

- October 13th 2008, 09:52 AMbatman
Just calculate the logarithms with base 2 and round down:

log(2008)/log(2) = 10.97... ==> 10

log(2008-2^10)/log(2) = 9.94... ==> 9

log(2008-2^10-2^9)/log(2) = 8.88... ==> 8

log(2008-2^10-2^9-2^8)/log(2) = 7...

log(2008-2^10-2^9-2^8-2^7)/log(2) = 6...

log(2008-2^10-2^9-2^8-2^7-2^6)/log(2) = 4...

log(2008-2^10-2^9-2^8-2^7-2^6-2^4)/log(2) = 3 exactly

So we have 2^10+2^9+2^8+2^7+2^6+2^4+2^3=2008.