A270740 Period 9: repeat 0,1,2,2,0,1,1,2,0.
0, 1, 2, 2, 0, 1, 1, 2, 0, 0, 1, 2, 2, 0, 1, 1, 2, 0, 0, 1, 2, 2, 0, 1, 1, 2, 0, 0, 1, 2, 2, 0, 1, 1, 2, 0, 0, 1, 2, 2, 0, 1, 1, 2, 0, 0, 1, 2, 2, 0, 1, 1, 2, 0, 0, 1, 2, 2, 0, 1, 1, 2, 0
Offset: 0
Links
- Index entries for linear recurrences with constant coefficients, signature (1,0,-1,1,0,-1,1).
Programs
-
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 *)
-
PARI
a(n) = (n - n\3) % 3; \\ Michel Marcus, Mar 22 2016
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)