TITLE: Recurrence relation and initial conditions for the number of ways to build a stack of height n cm using blocks.
QUESTION [0 upvotes]: I'm working on a problem, and I just want to make sure that my work is correct. The problem goes like this:

Suppose that we have a collection of building blocks consisting of red, blue, and
  green blocks of height 1 cm and yellow blocks of height 3 cm. Write a recurrence
  relation and initial conditions for the number of ways to build a stack of height n cm using these blocks.

I let Sn be the total number of ways, and this is my solution:
Sn = Sn-1 + Sn-1 + Sn-1 + Sn-3
Sn = 3Sn-1 + Sn-3
And with our initial conditions:
S0 = 1
S1 = 3 (blue or red or green)
S2 = 9
Sn = 3(9) + 1 = 28.

REPLY [1 votes]: Yes your answer is correct. I've done this one before! Similar answer here: https://answers.yahoo.com/question/index?qid=20160419091913AAPO82O
{"set_name": "stack_exchange", "score": 0, "question_id": 2509837}