login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

Period 6: repeat [0, 0, 1, 1, 1, 2].
4

%I #29 Dec 12 2023 08:14:12

%S 0,0,1,1,1,2,0,0,1,1,1,2,0,0,1,1,1,2,0,0,1,1,1,2,0,0,1,1,1,2,0,0,1,1,

%T 1,2,0,0,1,1,1,2,0,0,1,1,1,2,0,0,1,1,1,2,0,0,1,1,1,2,0,0,1,1,1,2,0,0,

%U 1,1,1,2,0,0,1,1,1,2,0,0,1,1,1,2,0,0,1,1,1,2,0,0,1,1,1,2,0,0,1,1,1,2,0,0,1

%N Period 6: repeat [0, 0, 1, 1, 1, 2].

%H <a href="/index/Rec#order_06">Index entries for linear recurrences with constant coefficients</a>, signature (0,0,0,0,0,1).

%F 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

%F 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

%F a(n) = a(n-6) for n>5. - _Wesley Ivan Hurt_, Jun 20 2016

%p f := proc(n) local j; j:=n mod 6; if (j<=1) then 0 elif (j<=4) then 1 else 2; fi; end;

%p A151899:=n->[0, 0, 1, 1, 1, 2][(n mod 6)+1]: seq(A151899(n), n=0..100); # _Wesley Ivan Hurt_, Jun 20 2016

%t Table[Abs[Mod[-n + 1, 3] - Mod[n + 1, 2]], {n, 0, 100}] (* _Wesley Ivan Hurt_, Aug 20 2014 *)

%t CoefficientList[Series[(x^2 + x^3 + x^4 + 2 x^5)/(1 - x^6), {x, 0, 100}], x] (* _Wesley Ivan Hurt_, Aug 20 2014 *)

%t LinearRecurrence[{0, 0, 0, 0, 0, 1},{0, 0, 1, 1, 1, 2},105] (* _Ray Chandler_, Aug 26 2015 *)

%o (Magma) [Abs( ((1-n) mod 3) - ((1+n) mod 2) ) : n in [0..100]]; // _Wesley Ivan Hurt_, Aug 20 2014

%o (PARI) a(n)=[0,0,1,1,1,2][n%6+1]; \\ _Joerg Arndt_, Aug 25 2014

%Y Cf. A151902, A151904, A151905, A151906, A151907.

%K nonn,easy

%O 0,6

%A _N. J. A. Sloane_, Jul 31 2009