6

This is a math competition question I did. Essentially, starting at B, a move consists of moving to a non-diagonal adjacent square and noting the letter you land on (with the exception of the starting letter B). How many ways can you spell BANANA?

enter image description here

So I've attempted this problem multiple times (to an incorrect answer) and have eventually resorted to the most primitive method, which was just listing every possible combination which does give me the right answer of 84.

What I did was I labelled each square with a number from 1 to 9 and wrote down all the possible 'number combinations' assuming the first move is a rightwards move and then multiplied it by 2 because of the symmetry of the puzzle.

While this is not wrong, could anyone suggest possibly a better/more elegant solution?

I'm not really sure what tags to add to this so please give some suggestions and I'll edit this post later. There is a solution provided in Dutch but I'm just curious about other ways as well.

enter image description here

Here is the English translation.

If the first N of BANANA is in the blue box as well as the second N, then there are two possibilities for the second and the third A, so $2+2 = 4$ possibilities for BANANA.
For blue-green there are likewise $2 \cdot 4 = 8$ possibilities.
For blue-white there are $1 \cdot 2 = 2$ possibilities. In total there are therefore $4 + 8 + 2 = 14$ possibilities if the first N is in the blue box.
If the first N is in the yellow box, there are also $14$ possibilities in the same way.
For green-green we find $2 \cdot 4 \cdot 4 = 32$ possibilities.
For green-blue we find $2 \cdot 2 \cdot 2 = 8$ possibilities, likewise for green-yellow and for green-white.
So if the first N is in the green box, there are $32+ 8 + 8 + 8 = 56$ possibilities.
In total you can make BANANA in $14 + 14 + 56 = 84$ ways.

Apass.Jack
  • 13,509

5 Answers5

18

$\stackrel{\text{B}}{\begin{array}{|c|c|c|c|c|}\hline 1 & \ &\ \\ \hline & & \\\hline & & \\\hline \end{array}}$ $\to$ $\stackrel{\text{BA}}{\begin{array}{|c|c|c|c|c|}\hline \ & 1 & \ \\\hline 1& & \\\hline & & \\ \hline \end{array}}$ $\to$ $\stackrel{\text{BAN}}{\begin{array}{|c|c|c|c|c|}\hline \ & & 1 \\\hline &2 & \hline\\\hline 1& & \\\hline \end{array}}$ $\to$ $\stackrel{\text{BANA}}{\begin{array}{|c|c|c|c|c|}\hline \ & 3 & \\\hline 3& & 3\\\hline &3 &\\\hline \end{array}}$ $\to$ $\stackrel{\text{BANAN}}{\begin{array}{|c|c|c|c|c|}\hline \ & & 6 \\\hline & 12& \\\hline 6& &6\\\hline \end{array}}$ $\to$ $\stackrel{\text{BANANA}}{\begin{array}{|c|c|c|c|c|}\hline \ & 18 & \\\hline 18 & &24 \\\hline &24 &\\\hline \end{array}}$

$18 + 18 + 24 + 24 = 84$.

This method is called "dynamic programming".

Apass.Jack
  • 13,509
  • 4
    +1: This is the cleanest answer here since its so simple to visualize the paths. I think you cannot get more concise than this. – dan Apr 24 '23 at 20:43
  • @Apass.Jack Could you check out the following question again if you have time: https://math.stackexchange.com/questions/4705758/find-the-area-of-five-quadrilaterals-and-one-triangle? – user1127 May 26 '23 at 21:54
  • @user1127 That question of your is fine since you have updated it. I have deleted my comment over there. Please delete your comment here. – Apass.Jack May 27 '23 at 00:01
5

A diagram-based solution might look like this: First, draw that same diagram and count how many ways we can start at each square and spell 'A'. Therefore, each square will have a $1$ if it's an 'A' square and a $0$ otherwise. This yields the diagram

$$\begin{array}{c} \text{A} \\ \begin{array}{|c|c|c|}\hline 0 & 1 & 0 \\ \hline 1 & 0 & 1\\ \hline 0 & 1 & 0\\ \hline\end{array}\end{array}$$

Next, another diagram, this time counting the number of ways we can start at each square and spell "NA". To do this, we note that we must start on an 'N' square and move to one of the adjacent squares from which we can then spell "A", but we already have a diagram counting the number of ways to spell "A", so this just means we will sum the adjacent numbers for every 'N' square, and otherwise we'll write $0$ on and non-'N' square:

$$\begin{array}{c}\text{NA} \\ \begin{array}{|c|c|c|}\hline 0 & 0 & 1+1=2 \\ \hline 0 & 1+1+1+1=4 & 0\\ \hline 1+1=2 & 0 & 1+1=2\\ \hline\end{array}\end{array}$$

Next, to spell "ANA", we start on an 'A' square and then move to an adjacent square, from which we spell "NA", so we take every 'A' square and add adjacent squares from the "NA" diagram:

$$\begin{array}{c}\text{ANA} \\ \begin{array}{|c|c|c|}\hline 0 & 2+4=6 & 0 \\ \hline 2+4=6 & 0 & 2+4+2=8 \\ \hline 0 & 2+4+2=8 & 0\\ \hline\end{array}\end{array}$$

and this pattern continues, giving

$$\begin{array}{c}\text{NANA} \\ \begin{array}{|c|c|c|}\hline 0 & 0 & 6+8=14 \\ \hline 0 & 6+6+8+8=28 & 0 \\ \hline 6+8=14 & 0 & 8+8=16\\ \hline\end{array}\end{array}$$

followed by

$$\begin{array}{c}\text{ANANA} \\ \begin{array}{|c|c|c|}\hline 0 & 14+28=42 & 0 \\ \hline 14+28=42 & 0 & 14+16+28=58 \\ \hline 0 & 14+16+28=58 & 0\\ \hline\end{array}\end{array}$$

and finally, to spell "BANANA", we have to start at the only 'B' square and move to an adjacent 'A' square after which we spell "ANANA", so we add the only two 'A' squares adjacent to 'B' in the "ANANA" counts: $$42+42 = 84$$

  • 1
    +1: This is nice. It is unclear to me whether your answer refutes my answer, but the point of view can certainly be argued. – user2661923 Apr 24 '23 at 20:25
1

Personally, if I was attacking this problem, I (also) would resign myself to brute force.

There are $~2~$ symmetrical choices for the 1st move, so you can reserve the factor of $~(2)~$ and then assume, without loss of generality that your first move is to the right.

However, then, the choices of moving down or to the right result in asymmetrical situations which have to be (manually) examined separately.

That is, if you move down, you will have $~4~$ choices for your third move, while if (instead) you move to the right, you will only have $~2~$ choices for your third move.

Similarly, under the assumption that your second move is down, you now have $~4~$ choices for the third move, where (again) 1 pair of choices is asymmetric to the other pair of choices.

That is, with one of the pairs, you would then have $~3~$ choices for your next move, while with the other pair, you would then have only $~2~$ choices for your next move.

user2661923
  • 42,303
  • 3
  • 21
  • 46
1

The simplest method is to consider a tree of actions. We know that if we will have to form $BA$ first, and there are two such choices. Then, things get intereting, since we cannot return to $B$.

Tree Diagram of Choices

When we go from $A\rightarrow N$ we can select one of two $N$s. When we go from $N \rightarrow A$ again, we are either a corner $N$ or a central $N$. If we are a corner $N$, we have $2$ choices of $A$. If we are not a corner $N$, we have $4$ choices of $A$. From $N \rightarrow A$, the $2$ choices of $A$ from a corner $N$ gives us a choice of two $A$s not adjacent to $B$, or two $A$s adjacent to $B$. When we go from non-adjacent $A$s, we have $3$ choices of $N$. If we are adjacent, we have $2$ choices of $N$. Finally, we return back to corner and central $N$, of which we repeat the logic from before.

Therefore, as the tree diagram shows, we count $42$ choices per $A$ that forms $BA$, so $42 + 42 = 84$.

dan
  • 419
0

Denote $N_1$ as a corner $N$ and $N_2$ as the central $N$. Next, denote $A_1$ as an $A$ adjacent to $B$ and $A_2$ as an $A$ not adjacent to $B$.

Each $N_1$ gives rise to one $A_1$ and one $A_2$. Each $N_2$ to two $A_1$ and two $A_2$.

Each $A_1$ gives rise to one $N_1$ and one $N_2$. Each $A_2$ gives rise to one $N_2$ and two $N_1$.

We can model this relationship by the set of equations:

$$\begin{align*}&A_1 = N_1 + N_2\\ &A_2 = 2 \cdot N_1 + N_2 \\&N_1 = A_1 + A_2, \\&N_2 = 2(A_1 + A_2)\end{align*}$$

Moreover, we assign $N_1$ and $N_2$ the numbers $2$ and $4$ respectively, as this is the number of final choices of $A$ for each type of letter.

Therefore,

$\begin{align*}A_1 + A_1 = 2(N_1 + N_2) &= 2((A_1 + A_2) + 2(A_1 + A_2)) \\&= 6(A_1 + A_2)\\&=6((N_1 + N_2) +(2N_1 + N_2))\\&=6(3N_1 + 2N_2)\\&=6\cdot 14 = 84\end{align*}$

dan
  • 419