General term formula of sequence 4,13,40121 4.13.40.121 . I know that each term is the first term * 3 + 1, but I want the general term formula not the recursive formula

General term formula of sequence 4,13,40121 4.13.40.121 . I know that each term is the first term * 3 + 1, but I want the general term formula not the recursive formula

1.4.13.40.121.14 = 1 * 3 + 113 = (1 * 3 + 1) * 3 + 1 = 1 * 3 ^ 2 + 3 + 140 = [(1 * 3 + 1) * 3 + 1] * 3 + 1 = 1 * 3 ^ 3 + 3 ^ 2 + 3 + 1 121 = {[(1 * 3 + 1) * 3 + 1] * 3 + 1 * 3 + 1} * 3 + 1 = 1 * 3 ^ 4 + 3 ^ 3 + 3 ^ 2 + 3 + 1. An = 3 ^ (n-1) + 3 ^ (n-2) +. + 3 ^ 2 + 3 + 1 = (sum of proportional sequence, A1 = 1, q = 3