Quite an interesting problem popped up my twitter feed the other day:

Take a few minutes and try to devise a solution to this problem.

OK, let’s get down to business and solve this!

I immediatly thought about this problem as if we’re trying to arrange two types of balls in a row - say, green and red. The green balls would be synonymous with horizontally laid couples of brownies, and the red would be synonymous with the rest, vertically laid, single brownies.

In this case, only these configurations are possible:1

Green Red
0 12
1 10
2 8
3 6
4 4
5 2
6 0

For each configuration, multiple possible arrangements can be made.
For example, when we have 0 green balls, there’s only 1 possible arrangement. When there’s a single green ball, there are 11 possible arrangements, and when there are 2 green balls, we need to choose 2 locations for them from 10 possible locations, which is \(10 \choose 2\).

This leads us to the general formula for the number of arrangements per a single configuration:

\[\#green+\#red \choose \#green \\\]

Of course, we need to sum this over the possible configurations, and so we end with the following formula for the number of available possible arrangements:

\[\#Arrangements = \sum\limits_{i=0}^{6} {12-i \choose i} = 233 \\\]

This can also be generalized to the general case, in which we have \(n\) éclairs in total:2

\[a_{n+1} = \sum\limits_{i\geq0}^{} {n-i \choose i} \\\]

The solution given in the tweet is a bit more elegent to my taste. In essence, it decomposes the problem recursively to the number of available arrangements for fewer brownies. It all boils down to the well known formula for fibonnaci numbers:

\[a_{n+1} = a_{n} + a_{n-1} \\\]

where \(a_{n+1}\) is the number of possible arrangements for \(n+1\) brownies.

Thus, we can actually deduce the following formula for fibonacci numbers:

\[\frac{1}{\sqrt{5}}\left[\left(\frac{1+\sqrt{5}}{2}\right)^{n+1} -\left(\frac{1-\sqrt{5}}{2}\right)^{n+1}\right] = a_{n} + a_{n-1} = a_{n+1} = \sum\limits_{i\geq0}^{} {n-i \choose i} \\\]

I just love it when two different subjects pop into solutions of problems - more so when it gives out a formula that binds them together! 🤩

  1. A simple way to verify the validity of these configurations would be to notice that \(2 \times \#green + \#red = 12\) 

  2. Where we take \(\binom{n}{k} = 0\) if \(k>n\)