Given the input sequence 1,2,3,4,5,6,7,8,9........

how do you convert it to 2,1,0,2,1,0,2,1,0.........

All I have at the moment is this:

Output = (3-(Input mod 3)) mod 3

Which does work but it looks a bit clumsy, anyone know a better way?