A060582 If the final digit of n in base 3 is the same as a([n/3]) then this digit, otherwise a(n)= mod 3-sum of these two digits, with a(0)=0.
0, 2, 1, 1, 0, 2, 2, 1, 0, 2, 1, 0, 0, 2, 1, 1, 0, 2, 1, 0, 2, 2, 1, 0, 0, 2, 1, 1, 0, 2, 2, 1, 0, 0, 2, 1, 0, 2, 1, 1, 0, 2, 2, 1, 0, 2, 1, 0, 0, 2, 1, 1, 0, 2, 2, 1, 0, 0, 2, 1, 1, 0, 2, 1, 0, 2, 2, 1, 0, 0, 2, 1, 0, 2, 1, 1, 0, 2, 2, 1, 0, 2, 1, 0, 0, 2, 1, 1, 0, 2, 1, 0, 2, 2, 1, 0, 0, 2, 1, 0, 2, 1, 1, 0, 2
Offset: 0
Examples
a(4)=0 since a([4/3])=a(1)=2, (4 mod 3)=1 and 3-2-1=0. a(5)=2 since a([5/3])=a(1)=2 and (5 mod 3)=2.
Crossrefs
Cf. A060588.
Formula
a(n) =(-a([n/3])-n) mod 3 =A060583(n) mod 3.