OFFSET
0,3
LINKS
Index entries for linear recurrences with constant coefficients, signature (1,0,-1,1,0,-1,1).
FORMULA
a(n) = (n - floor(n/3)) mod 3.
From Chai Wah Wu, Jun 04 2016: (Start)
a(n) = a(n-1) - a(n-3) + a(n-4) - a(n-6) + a(n-7) for n > 6.
G.f.: x*(1 + x - x^3 + 2*x^4)/((1 - x)*(1 + x^3 + x^6)). (End)
MATHEMATICA
Table[Mod[n - Floor[n/3], 3], {n, 0, 120}] (* Michael De Vlieger, Mar 25 2016 *)
PadRight[{}, 120, {0, 1, 2, 2, 0, 1, 1, 2, 0}] (* Harvey P. Dale, Jan 16 2019 *)
PROG
(PARI) a(n) = (n - n\3) % 3; \\ Michel Marcus, Mar 22 2016
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
William Walkington, Mar 22 2016
STATUS
approved