4
24 == 16 < 23 < 25 == 32
So, starting with 24 :
Power of 2 | Include? | Subtraction | Binary so Far |
---|---|---|---|
24 == 16 | 16 is less than 23 | 23 - 16 == 7 | 1 _ _ _ _ |
23 == 8 | 8 is greater than 23 | not done | 1 0 _ _ _ |
22 == 4 | 4 is less than 7 | 7 - 4 == 3 | 1 0 1 _ _ |
21 == 2 | 2 is less than 3 | 3 - 2 == 1 | 1 0 1 1 _ |
20 == 1 | 1 equals 1 | 1 - 1 == 0 | 1 0 1 1 1 |
So 23 represented in binary is 10111.
Check this by adding up the included powers of two:
16 + 4 + 2 + 1 = 23
What is the largest power of two less than or equal to 49?