#APL+WIN, 33 bytes Prompts for vector of integers max first: ((1+⌈⌈/2⍟v)⍴2)⊤v←(↑v)+0,⍳-/v←⎕ [Try it online! Courtesy of Dyalog Classic][TIO-ji1vy7dh] [APL (Dyalog Classic)]: https://www.dyalog.com/ [TIO-ji1vy7dh]: https://tio.run/##SyzI0U2pTMzJT9dNzkksLs5M/v@ob6qvz6O2CcZcjzra0/5r6@toaBhqP@rpACJ9o0e988s0H/VuMdJ81LWkDKhM41HbxDJNbQOdR72bdfVBIkAD/gO1/k/jMlcwAQA "APL (Dyalog Classic) – Try It Online" Explanation: v←⎕ prompt for input of a vector of two integers max first (↑v)+0,⍳-/ create a vector of integers from max to min ((1+⌈⌈/2⍟v)⍴2) determine max power of 2 ⊤ convert integers to a matrix of binaries +/, convert matrix to a vector and sum