This is LaTeX code:
[latex]
a_n = \frac{2^n + (-1)^n \cdot 2 }{3}
[/latex]