What is the general term formula of sequence 1,4,13,40121 Such as the title

What is the general term formula of sequence 1,4,13,40121 Such as the title

∵ sequence is 1,4,13,40121,... 4 = 1 + 3 ^ 1,13 = 4 + 3 ^ 2,40 = 13 + 3 ^ 3121 = 40 + 3 ^ 4,... That is: a [n + 1] = a [n] + 3 ^ n can use the undetermined coefficient method, but because it is relatively simple, we directly subtract 3 ^ (n + 1) / 2 = (3 / 2) 3 ^ n on both sides to get: a [n + 1] - 3 ^ (n + 1) / 2 = a [n] - 3 ^ n / 2 ∵ a [1] = 1 ∵ {a [n] - 3