(This is the answer to the puzzle proposed in the previous post.)
If you write all binary numbers between 0 and 2n-1 you will notice that the columns show a pattern. See for example the first 8 binary numbers:
000 001 010 011 100 101 110 111
Each column has exactly the same number of zeroes and ones! Then the total number of ones is half the total number of digits:
.
Once we have the formula, the values for n = 1 to 50 can easily be calculated.