I\'m trying to create a function that receives a number as an argument and performs actions on that number to find out its closest powers of 2 that will then add up to that
Most efficient way of doing this:
def myfunc(x): powers = [] i = 1 while i <= x: if i & x: powers.append(i) i <<= 1 return powers