0

How many ways are there to arrange $N$ black and white balls such that there is no sequence which has strictly more than 2 consecutive white or black balls.

So BBWWBWBW is fine but BBWWWBWBW is not since there is a WWW sequence.

You have as many black and white balls as you want, but the total balls in the sequence is some value $N$.

3 Answers3

1

Denote the set of admissible words of length $n$ over the alphabet $\{B,W\}$ by $A_n$, and put $\#A_n=:a_n$. Then $a_1=2$, $a_2=4$. I claim that we have the recursion $$a_n=a_{n-1}+a_{n-2}\qquad(n\geq3)\ .\tag{1}$$ Proof. For any word $w$ of length $\geq3$ denote by $w'$ the word obtained by deleting the last letter of $w$. A word $w\in A_n$ either ends with two different letters, or with two equal letters. In the first case the word $w'\in A_{n-1}$ ends with one of $B$ or $W$, and one obtains $w$ from $w'$ by writing an additional $W$ or $B$ at the end. In the second case the word $w''\in A_{n-2}$ ends with one of $B$ or $W$, and one obtains $w$ from $w''$ by writing $WW$ or $BB$ at the end. All in all, the described procedure sets up a bijection between $A_n$ and $A_{n-1}\cup A_{n-2}.\qquad\square$

From the quoted initial values and $(1)$ it follows that $$a_n=2 F_{n+1}\qquad(n\geq1)\ ,$$ whereby $F_n$ denotes the $n^{\rm th}$ Fibonacci number, $F_0=0$.

0

A couple of hints:

1) The number of arrangements can be broken down into the number of arrangements that start with a B and the number that start with a W.

2) If it starts with a W: there must be either one W or two Ws. After that, we must have a sequence that starts with a B and still satisfies the original property.

3) If it starts with a B: there must be either one B or two Bs. After that, we must have a sequence that starts with a W and still satisfies the original property.

This should feel very much like it is heading toward a recurrence relation for the numbers that you want. But, it looks like a system of recurrence relations: one for $b_n$ in terms of previous values of $w_j$, and one for $w_n$ in terms of previous values of $b_i$. However, there may be a symmetry argument that could help.

Nick Peterson
  • 32,430
0

Using the DFA method from the following MSE link we obtain the following session transcript:

> GFNC([[0,0,0], [1,1,1]], 2,true); 
                                [[1, 1, 1], [0, 0, 0]]

                                     Q[], 0, Q[0]

                                     Q[], 1, Q[1]

                                   Q[0], 0, Q[0, 0]

                                    Q[0], 1, Q[1]

                                Q[0, 0], 0, Q[0, 0, 0]

                                   Q[0, 0], 1, Q[1]

                              Q[0, 0, 0], 0, Q[0, 0, 0]

                              Q[0, 0, 0], 1, Q[0, 0, 0]

                                    Q[1], 0, Q[0]

                                   Q[1], 1, Q[1, 1]

                                   Q[1, 1], 0, Q[0]

                                Q[1, 1], 1, Q[1, 1, 1]

                              Q[1, 1, 1], 0, Q[1, 1, 1]

                              Q[1, 1, 1], 1, Q[1, 1, 1]

                                        2
                                       z  + z + 1
                                     - ----------
                                        2
                                       z  + z - 1

> seq(coeftayl(%, z=0, n), n=1..13);
                 2, 4, 6, 10, 16, 26, 42, 68, 110, 178, 288, 466, 754

The sequence from this generating function is $$2, 4, 6, 10, 16, 26, 42, 68, 110, 178, 288, 466, 754,\ldots$$

Marko Riedel
  • 61,317