Among the binary strings of length $n$ , what is the distribution of the lengths of the homogeneous runs ? E.g., for $n=4$ the possible strings and run lengths are $$0000: 4;0001: 1,3;0010: 1^2,2;0011:2^2; \\0100: 1^2,2;0101: 1^4;0110: 1^2,2;0111:1,3; \\1000: 1,3;1001: 1^2,2;1010: 1^4;1011:1^2,2; \\1100: 2^2;1101: 1^2,2;1110: 1,3;1111:4 $$ giving the histogram $$1:24,\\ 2:10,\\ 3:4,\\4: 2.$$ I am also interested in the numbers of runs: $$0000: 1;0001: 2;0010: 3;0011:2; \\0100: 3;0101: 4;0110: 3;0111:2; \\1000: 2;1001: 3;1010: 4;1011:3; \\1100: 2;1101: 3;1110: 2;1111:1 $$ giving the histogram $$1:2,\\ 2:6,\\ 3:6,\\4: 2.$$ Are there closed-form formulas ? Update: By shameless brute force computation I observe that the distribution of the numbers of runs are the doubles of the Binomial numbers, and the distribution of the lengths follows the double of the sequence https://oeis.org/A045623 , giving the formula $$2\sum_{i=0}^{n-k}(i+2)\binom{n-k}i.$$

Full article content could not be extracted automatically. Read the original below.