Bulb switching efficiency

251 Views Asked by At

I have $N$ bulbs and $N - 1$ switches. Now $i^{th}$ bulb can be switched $ON$ by $i^{th}$ switch or ${i-1}^{th}$ switch. Initially all bulbs and switches are $OFF$. Now there are $N!$ ways sequence of pressing switches. So for each permutation there is an efficiency function associated with that. The efficiency function is after pressing how many switches all bulbs become $ON$.

Let's take an example of $4$ bulbs $3$ switches,
Permutation => Efficiency
1 2 3 => 3
1 3 2 => 2
2 1 3 => 3
2 3 1 => 3
3 1 2 => 2
3 2 1 => 3

Now my question is how to get total efficiency? Here it's $2*2 + 3*4 = 16$

Here it's obvious that efficiency would be from $\lceil N/2 \rceil$ to $N - 1$. My approach is like how many switches contribute $ON$ all bulbs and I am trying to arrange accordingly to get a particular efficiency. For example $1$ and $3$ could ON all $4$ bulbs so permutation of $\{1, 3\}$ would result efficiency $2$ and rest of $3!$ is $3$. For $5$ bulbs for efficiency $3$ count would be $3!*2$ and rest would be for $4$. Similarly for $6$ bulbs efficiency $3$ count would be $3!*2!$ but for efficiency $4$ I messed up!! .. so could you please help to push into right direction or some sort of intuition?

1

There are 1 best solutions below

6
On BEST ANSWER

First let us solve an auxiliary problem. Let a monochrome sequence of balls be defined as a sequence of balls of the same color terminated at both ends either by the balls of another color or by the ends of the row. Let the length of the monochrome sequence be defined as the number of balls in the sequence.

Let $N_b$ and $N_w$ be the numbers of black and white balls, respectively, which we would like to arrange in a row according to the following rules.

  1. If the first sequence is black it is of length $1$ or $2$, all other black sequences are of length $1$, and the last sequence is white.
  2. If the last sequence is black it is of length $1$ or $2$, all other black sequences are of length $1$, and the first sequence is white.
  3. If the first and last sequences are white, one black sequence is of length $2$ or $3$ and all other black sequences are of length $1$.

Observe that if one considers the white balls as switches turned ON, there are exactly 1 or 2 bulbs which are still OFF and they can be turned on by one of the remaining switches.

The question is: how many sequences satisfying the above conditions exist for given $N_w $ and $N_b $?

The sequences in question have the following forms: $$\begin{align} 1.\quad& Bwbwbw\dots wbw\\ 2.\quad& wbwbwb\dots bwB\\ 3.\quad& wbwbwB\dots wbw, \end{align}$$ where $B$ is of length $1$ or $2$ in the first two cases, and of length $2$ or $3$ in the third case, $b$ are of the length $1$, and $w$ are of length at least $1$.

Observe that the sequence "$b$" does not satisfy any of the above conditions. Therefore the resulting expressions are valid only if the number of switches is larger than 1.

Case 1 and 2.

If length of $B$ is 1, we have $N_b$ bins to place the white balls. After we fill each bin marked as "$w$" with one white ball, we can distribute the rest $N_w-N_b$ white balls arbitrarily among $N_b$ bins. By stars and bars the corresponding count is: $$ N_{11}=N_{21}=\binom{N_w-1}{N_b-1}.\tag1 $$ If the length of $B$ is $2$ the number of bins is reduced by $1$ and we have $$ N_{12}=N_{22}=\binom{N_w-1}{N_b-2}.\tag2 $$

Case 3.

The same reasoning as in the former case results in the expressions: $$ N_{32}=(N_b-1) \binom{N_w-1}{N_b-1},\quad N_{33}=(N_b-2)\binom{N_w-1}{N_b-2},\tag3 $$ where the prefactors stay for the number of ways to choose the position of $B$.

Thus the overall number of such combinations that the replacement of one black ball at a specified position with the white one removes the last gap in the sequence to switch on the last bulb(s) reads: $$\begin{align} N_{11}+N_{12}+N_{21}+N_{22}+2N_{32}+N_{33} &=\binom{N_w-1}{N_b-1}2N_b+\binom{N_w-1}{N_b-2}N_b\\ &=\left[\binom{N_w-1}{N_b-1}+\binom{N_w}{N_b-1}\right]N_b\tag4 \end{align} $$ where the factor $2$ at $N_{32}$ stays for two possible ways to switch on the last bulb. In all other cases this can be done in a single way.

To obtain the full number of permutations $N_k$ with given efficiency $k=N_w+1$ the above expression should be multiplied by the factor $N_w!(N_b-1)!$ which counts the permutations of the switches (white balls) leading to the decisive combination and the permutations of the remaining switches (which perform no action).

In terms of the efficiency $k$ and the total number of switches $n$ the expression for $N_k$ reads upon substitution $N_w=k-1,N_b=n-k+1$: $$ N_k=\left[\binom{k-2}{n-k}+\binom{k-1}{n-k}\right](k-1)!(n-k+1)!\tag5 $$

The total efficiency $K=\sum N_kk$ is accordingly: $$ K(n)=\sum_{k=2}^n\left[\binom{k-2}{n-k}+\binom{k-1}{n-k}\right]k!(n-k+1)!\tag6 $$