8.7k views
1 vote
Of the positive integers less than 2021, how many can be written

as a difference of two powers of 2?

User Movac
by
8.0k points

1 Answer

4 votes

Answer:

61

Explanation:

You want the number of positive integers less than 2021 that can be written as the difference of two powers of 2.

Powers of 2

2^12 = 4096 and higher powers cannot produce integers less than 2021 when other powers of 2 are subtracted. Hence we're looking for pairs of powers that are 2^11 and smaller.

2^11 = 2048, which is 27 more than 2021. This means a number in range can be generated only by subtracting a power of 2 from 2^11 that is 2^5 = 32 or greater.

Combinations

There are 66 pairs (combinations) of numbers in the range 0 to 11. Except for the 5 pairs (11, 0), (11, 1), (11, 2), (11, 3), (11, 4), they all represent pairs of powers of 2 that will have a unique difference less than 2021.

There are 61 positive integers less than 2021 that can be written as the difference of powers of 2.

User Nhor
by
7.5k points