login
Period 6: repeat [2, 2, 2, 1, 1, 1].
1

%I #29 Mar 15 2024 02:19:45

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

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

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

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

%C a(n) = 2 for n = 0,1,2 modulo 6; a(n) = 1 for n = 3,4,5 modulo 6.

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

%F G.f.: (1+2*x^3)/((1-x)*(1+x)*(1-x+x^2)); a(n) = 3/2-(-1)^n/6-A057079(n)/3. [_R. J. Mathar_, Sep 17 2008]

%F a(n) = a(n-1) - a(n-3) + a(n-4) for n>3; a(n) = 1 + mod(floor((-n-1)/3), 2); a(n) = A088911(n) + 1. - _Wesley Ivan Hurt_, Sep 04 2014

%F a(n) = (9 + cos(n*Pi) + 2*cos(n*Pi/3) + 2*sqrt(3)*sin(n*Pi/3))/6. - _Wesley Ivan Hurt_, Jun 23 2016

%p A144110:=n->1+(floor((-n-1)/3) mod 2): seq(A144110(n), n=0..100); # _Wesley Ivan Hurt_, Sep 04 2014

%t Table[1 + Mod[Floor[(-n - 1)/3], 2], {n, 0, 100}] (* _Wesley Ivan Hurt_, Sep 04 2014 *)

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

%o (PARI) a(n)=[2,2,2,1,1,1][n%6+1] \\ _Edward Jiang_, Sep 04 2014

%Y Cf. A057079, A088911, A135265.

%K nonn,easy

%O 0,1

%A _Philippe Deléham_, Sep 11 2008, Sep 15 2008