How can I get sequence $4,4,2,4,4,2,4,4,2\ldots$ into equation? How can I write an equation that expresses the nth term of the sequence:
$$4, 4, 2, 4, 4, 2, 4, 4, 2, 4, 4, 2,\ldots$$

What about
$$a_n:=\left\{\begin{array}{}4\,,&\text{if}\,\;\;n\neq 0\pmod 3\\2\,,&\text{if}\,\;\;n=0\pmod 3\end{array}\right....?$$
