I jost woke up and an "easier" solution came to my mind, perhaps it was even the solution you were expected to give.
Let the way to pave a 2xN block be denoted by G(N). Then
[Edit:] Just found the below is wrong.
G(N)= 2G(N-1)+3G(N-2).
There is a way to solve such "recurrence relations" directly, in "closed form", see
http://en.wikipedia.org/wiki/Recurrence_relation . But, just for fun, let us do it by hand :)
To explain why
G(N)= 2G(N-1)+3G(N-2),
just note that either the first 2 x 1 block is like this | or like this :, which is two combinations, so
G(N)=2G(N-1)+...
, but you also have the option for starting with a horizontal 2x1 block, like this _ or like this -, or with a two lying horizontal blocks =, which accounts for the coefficient 3.
[Edit:] Or you can start with ._ on the bottom and - on the top. Which makes the above simple "solution" wrong. A famoust quote (heard it attributed to Einstein): One should make matters as simple as possible, but never simpler!
Therefore
1 2 3 4 5 6 7 8 9
|
G(0)=1
G(1)=2
G(2)=7
G(3)=2*7+3*2 = 14+(7-1)= 14+6= 20
G(4)=2*20+3*7 = 40+(20+1) = 61
G(5)=2*61+3*20 = 122+(61-1) = 182
G(6)=2*182+3*61 = 364+(182+1) = 547
G(7)=1094+182*3 = 1094+ (547-1) = 1640
G(8)=1650*2+547*3 = 3300+ (1640+1)= 3941
|