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$$

$$
f(n) = 
\begin{cases}
4 \text{ if } n \equiv 0 \text{ or } 1 \text{ (mod 3)}\\
2 \text{ if } n \equiv 2 \text{ (mod 3)}
\end{cases}
$$
