OFFSET
0,6
LINKS
Index entries for linear recurrences with constant coefficients, signature (0,0,0,0,0,1).
FORMULA
a(n) = 5/6 - cos(Pi*n/3)/3 - sin(Pi*n/3)/sqrt(3) - cos(2*Pi*n/3)/3 - sin(2*Pi*n/3)/sqrt(3) - (-1)^n/6. - R. J. Mathar, Oct 08 2011
G.f.: (x^2+x^3+x^4+2*x^5)/(1-x^6); a(n) = abs( mod(1-n,3) - mod(1+n,2) ). - Wesley Ivan Hurt, Aug 20 2014
a(n) = a(n-6) for n>5. - Wesley Ivan Hurt, Jun 20 2016
MAPLE
f := proc(n) local j; j:=n mod 6; if (j<=1) then 0 elif (j<=4) then 1 else 2; fi; end;
A151899:=n->[0, 0, 1, 1, 1, 2][(n mod 6)+1]: seq(A151899(n), n=0..100); # Wesley Ivan Hurt, Jun 20 2016
MATHEMATICA
Table[Abs[Mod[-n + 1, 3] - Mod[n + 1, 2]], {n, 0, 100}] (* Wesley Ivan Hurt, Aug 20 2014 *)
CoefficientList[Series[(x^2 + x^3 + x^4 + 2 x^5)/(1 - x^6), {x, 0, 100}], x] (* Wesley Ivan Hurt, Aug 20 2014 *)
LinearRecurrence[{0, 0, 0, 0, 0, 1}, {0, 0, 1, 1, 1, 2}, 105] (* Ray Chandler, Aug 26 2015 *)
PROG
(Magma) [Abs( ((1-n) mod 3) - ((1+n) mod 2) ) : n in [0..100]]; // Wesley Ivan Hurt, Aug 20 2014
(PARI) a(n)=[0, 0, 1, 1, 1, 2][n%6+1]; \\ Joerg Arndt, Aug 25 2014
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
N. J. A. Sloane, Jul 31 2009
STATUS
approved