We have the recurrence relation an+1−an=3n, for n less than 0, where a0=1.
Let's consider the sequence bm=a−m, m=−n, such that m∈N∪{0}. Then
an+1−an=a−m+1−a−m=bm−1−bm=3n=−3m, or bm−bm−1=3m.
bm=(bm−bm−1)+(bm−1−bm−2)+⋯+(b1−b0)+b0
=3m+3(m−1)+⋯+3+b0=23m(m+1)+1
The generating function of the sequence an is
f(z)=n=−∞∑0anzn=m=0∑+∞bmz−m=
m=0∑+∞(23m(m+1)+1)z−m=m=0∑+∞z−m+23m=0∑+∞m(m+1)z−m
=1−z−11+23z2dz2d2m=0∑+∞z−m=1−z−11+23z2dz2d21−z−11
=1−z−11+3(z−1)3z2=1−z−11+(1−z−1)33z−1
Answer. The generating function of the sequence an is f(z)=1−z−11+(1−z−1)33z−1.