Sum of Powers of 2
JavaScript (ES6), 28 bytes
f=n=>n?[...f(n&~-n),n&-n]:[]
Try it online!
Jelly, 4 bytes
-2 since we may output zeros in place of unused powers of 2 :)
Ḷ2*&
Try it online!
How?
Ḷ2*& - Link: integer, n e.g. 10
Ḷ - lowered range of n [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
2* - two to the power of [ 1, 2, 4, 8, 16, 32, 64,128,256,512]
& - bit-wise and [ 0, 2, 0, 8, 0, 0, 0, 0, 0, 0]
Pure Bash, 20
echo $[2**{7..0}&$1]
Try it online!
Explanation
{7..0} # Brace expansion: 7 6 5 4 3 2 1 0
2**{7..0} # Brace expansion: 128 64 32 16 8 4 2 1
2**{7..0}&$1 # Brace expansion: 128&n 64&n 32&n 16&n 8&n 4&n 2&n 1&n (Bitwise AND)
$[2**{7..0}&$1] # Arithmetic expansion
echo $[2**{7..0}&$1] # and output