Number of different ways of building a column

45 Views Asked by At

You are given concrete blocks with dimension $(1x1)$ which can be : $\{white,green,black\}$

and concrete blocks with dimension $(2x1)$ which can be : $\{red,gray\}$ in color. A vertical column should be made from the blocks with height $N$. In how many different ways can we build the column ?

Example : If $N = 2$ then there are 11 different ways to edit the blocks :

{(white, white) , (white, green) , (white, black) ,
(green, white) , (green, green) , (green, black) ,
(black, white) , (black, green) , (black, black) ,
red , gray} 

Let $C_{N}$ detonate the number of different ways in which the column of height $N$ can be build.

$C_{1} = 3^{1} = 3\\C_{2}=3^{2}+2^{1}=9+2=11\\...$

Is there a general way to calculate $C_{N}$ ?

1

There are 1 best solutions below

0
On BEST ANSWER

You can get a recursive formula for $C_n$--condition on whether the top-most block is $1\times 1$ or $2\times 1$.

If the top block is $1\times 1$, then there are $3\cdot C_{n-1}$ ways to have the tower (since you have $3$ (color) choices for the top block).

If the top block is $2\times 1$, then there are $2\cdot C_{n-2}$ ways to have the tower (since you have $2$ (color) choices for the top block).

So $C_n=3\cdot C_{n-1}+2\cdot C_{n-2}$.

You can take as your initial conditions $C_0 = 1$ (there is one empty tower); $C_1=3$. If the empty tower bothers you, you could alternatively use $C_1=3$ and $C_2=11$.

Note: You can explicitly solve this recursion if desired, since it is a linear recursion with a quadratic characteristic equation.