Looking for a function that maps natural numbers (zero included) into the series [1, 0, 2, 1, 0, 2, 1, 0, 2, ...]

I need a function that maps natural numbers (starting from zero) into the series [1, 0, 2, 1, 0, 2, 1, 0, 2, ...], i.e.:
f(0) = 1
f(1) = 0
f(2) = 2
f(3) = 1
f(4) = 0
f(5) = 2
...

The function f(x) = mod(x, 3) gives the series [0, 1, 2, 0, 1, 2, ...], but I can't come up with a function to get the series I want.


Take it one step at a time.

f(x) = mod(x, 3) gives the series [0, 1, 2, 0, 1, 2, ...]

f(x) = mod(x + 1, 3) shifts that to [1, 2, 0, 1, 2, 0, ...]

f(x) = 2 - mod(x + 1, 3) is a winner [1, 0, 2, 1, 0, 2, ...]


$$f(x)=1-\frac2{\sqrt3}\sin\frac{2\pi x}3$$