#APL+WIN, <s>33</s> 25 bytes Prompts for vector of integers: +/,(v⍴2)⊤(v←1↓v)+0,⍳-/v←⎕ [Try it online! Courtesy of Dyalog Classic][TIO-ji1zfx8v] [APL (Dyalog Classic)]: https://www.dyalog.com/ [TIO-ji1zfx8v]: https://tio.run/##SyzI0U2pTMzJT9dNzkksLs5M/v@ob6qvz6O2CcZcjzra0/5r6@tolD3q3WKk@ahrCZDVNsHwUdvkMk1tA51HvZt19UEiQC3/gYr/p3GZK5gAAA "APL (Dyalog Classic) – Try It Online" Explanation: v←⎕ prompt for input of a vector of two integers max first (v←1↓v)+0,⍳-/ create a vector of integers from min to max (v⍴2) set max power of 2 to max ⊤ convert integers to a matrix of binaries +/, convert matrix to a vector and sum