Let each sequence of capital Bulgarian letters be a word (Note that the Bulgarian alphabet consists of 30 letters). We say that a word is calm, if there is no sequence of the letter $P$ in it (two letters $P$ next to each other). Find a clear expression for $f(n)$ (closed formula), which represents the number of calm words with length $n$. Example: РНТ and ТТРВ are calm, but ЖГРР and ЖРРРП aren’t.
Problem
Source: V International Festival of Young Mathematicians Sozopol 2014, Theme for 10-12 grade
Tags: combinatorics, Combinatorics of words