A binary string is a word containing only $0$s and $1$s. In a binary string, a $1-$run is a non extendable substring containing only $1$s. Given a positive integer $n$, let $B(n)$ be the number of $1-$runs in the binary representation of $n$. For example, $B(107)=3$ since $107$ in binary is $1101011$ which has exactly three $1-$runs. What is the following expression equal to? $$B(1)+B(2)+B(3)+ \dots + B(255)$$
To solve the problem, we need to find the sum of the number of $1$-runs in the binary representations of all integers from $1$ to $255$. We denote this sum as:

\[ S = B(1) + B(2) + B(3) + \cdots + B(255) \]

We start by defining a function $a_n$ which represents the sum of $B(k)$ for all $k$ in the range $[2^{n-1}, 2^n - 1]$. That is,

\[ a_n = \sum_{k=2^{n-1}}^{2^n - 1} B(k) \]

We need to find the sum of $B(k)$ for $k$ from $1$ to $255$. Notice that $255 = 2^8 - 1$, so we can express the desired sum as:

\[ S = \sum_{n=1}^{8} a_n \]

Next, we need to understand the behavior of $a_n$. Let's consider the binary representations of numbers in the range $[2^{n-1}, 2^n - 1]$. These numbers have $n$ bits, and the leading bit is always $1$. The remaining $n-1$ bits can be any combination of $0$ and $1$.

For each $n$, the number of $1$-runs in the binary representations of numbers in the range $[2^{n-1}, 2^n - 1]$ can be analyzed as follows:

1. The leading bit is always $1$, contributing to at least one $1$-run.
2. The remaining $n-1$ bits can form additional $1$-runs.

To find $a_n$, we need to count the number of $1$-runs in all possible combinations of the remaining $n-1$ bits. We can use the following recursive relation:

\[ a_n = a_{n-1} + 2^{n-2} \]

This relation arises because:
- $a_{n-1}$ accounts for the $1$-runs in the first $n-1$ bits.
- $2^{n-2}$ accounts for the new $1$-runs introduced by the leading $1$ bit.

We can now compute $a_n$ for $n$ from $1$ to $8$:

1. For $n=1$: $a_1 = 1$ (only the number $1$ which has one $1$-run).
2. For $n=2$: $a_2 = a_1 + 2^{2-2} = 1 + 1 = 2$
3. For $n=3$: $a_3 = a_2 + 2^{3-2} = 2 + 2 = 4$
4. For $n=4$: $a_4 = a_3 + 2^{4-2} = 4 + 4 = 8$
5. For $n=5$: $a_5 = a_4 + 2^{5-2} = 8 + 8 = 16$
6. For $n=6$: $a_6 = a_5 + 2^{6-2} = 16 + 16 = 32$
7. For $n=7$: $a_7 = a_6 + 2^{7-2} = 32 + 32 = 64$
8. For $n=8$: $a_8 = a_7 + 2^{8-2} = 64 + 64 = 128$

Finally, we sum these values to find $S$:

\[ S = a_1 + a_2 + a_3 + a_4 + a_5 + a_6 + a_7 + a_8 \]
\[ S = 1 + 2 + 4 + 8 + 16 + 32 + 64 + 128 \]
\[ S = 255 \]

The final answer is $\boxed{255}$