I've solved this recurrence using the iteration method for even and odd values of $n$, but I cannot seem to find a singular explicit function that solves this recurrence for all values of $n$.
The recurrence is $$a(n) = \begin{cases} 1, & \text{if $n=0$} \\ 3^n-a(n-1)+1, & \text{otherwise} \end{cases}$$