Ways to fill a $4\times N$ box

67 Views Asked by At

Given the integer $N$, we need to tell how many ways exist to fill a $4\times N$ board with $1\times 4$ and $4\times 1$ size boxes.

Example: for $N=4$ there are $2$ ways.$ $

1

There are 1 best solutions below

0
On BEST ANSWER

The answer can be calculated recursively. For the base cases, for N=1,2,3, $a(N)=1$ and for N=4, $a(N)=2$. For $N>4$, $a(N)=a(N-1)+a(N-4)$, i.e, we either just place a 1×4 tile after every solution for a 4×(N-1) box, or , we can place 4 4×1 tiles after every solution for the 4×(n-4) box.

OEIS has the sequence and also a general formula for $a(N)$.