The solution goes like this
Number of ways to fill first seat is $x^2+x^3+x^7+x^9$
This is same for all seats
So number of ways to fill $n$ seats is
$$(x^2+x^3+x^7+x^9)^n$$
The summation of powers must be divisible by 3. So we want coefficient of $x^{3k}$ in $(x^2+x^3+x^7+x^9)^n$
So let $x=1,\omega , \omega^2$ where $\omega, \omega^2$ are cube roots of unity.
$$A=(1+1+1+1)^n =4^n$$ $$A=(\omega ^2 + 1 + \omega + 1)^n=1$$ $$A=(\omega +1+\omega + 1)^n=1$$
So $$A=\frac{4^n+2}{3}$$
I have no idea why and how they wrote it all in terms of $x$. I dont know what $x$ represents. Is this an algorithm or something conceptual?
As another way to do the computation:
Let $A_n$ be the number of "good" strings of length $n$. Let $B_n$ be the number of bad strings of length $n$, so $B_n=4^n-A_n$.
We remark that, for any bad string, there is a unique choice in the list that you can append to get a good string. For a good string, however, there are exactly two choices. Considering the sum of the digits therefore shows that we have the recursion $$A_{n+1}=2A_n+B_n$$
And, since $B_n=4^n-A_n$, this implies $$A_{n+1}=4^n+A_n$$ which quickly implies your formula.