Please reason step by step, and put your final answer within \boxed{}.
Given the sequence $\{a_n\}$ with the first 5 terms being 3, 4, 6, 10, 18, write a general formula for the sequence $\{a_n\}$.
user