Sum of Binary Substrings
Jelly, 10 7 bytes
BṡRḄFS_
Try it online!
How it works
BṡRḄFS_ Main link. Input: n
B Convert n to base 2.
R Yield [1, ..., n].
ṡ Get all overlapping slices of lengths 1 to n.
This yields empty arrays if the slice size is longer than the binary list.
Ḅ Convert each binary list to integer.
F Flatten the resulting, nested list.
S Compute the sum of the result.
_ Subtract n from the sum.
Pyth, 10
sPiR2.:.BQ
Try it online or run the Test Suite
Explanation:
sPiR2.:.BQ ## Q = eval(input())
.BQ ## get binary string of Q
.: ## get all substrings of that
iR2 ## convert them all to base 10
sP ## sum all but the last element, which is the input number
CJam, 27 21 bytes
Shoutout to Dennis for helping me save 6 bytes!
q~:Q{)Q2bew2fb~}%1bQ-
Works only with the newest version of CJam (available on TIO). Try it online!
Old version:
qi2b_,,0-\f{ew}{{2b}%}%e_:+
Try it online.