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

%I #22 Dec 12 2023 09:15:08

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

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

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

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

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

%F a(n) = A061347(n+1) * (-1)^floor(n/3).

%F From _Wesley Ivan Hurt_, Jun 21 2016: (Start)

%F G.f.: (1+x-2*x^2)/(1+x^3).

%F a(n) + a(n-3) = 0 for n>2.

%F a(n) = (5*cos(n*Pi/3) - 2*cos(n*Pi) - sqrt(3)*sin(n*Pi/3))/3. (End)

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

%t PadRight[{}, 100, {1, 1, -2, -1, -1, 2}] (* _Wesley Ivan Hurt_, Jun 21 2016 *)

%o (PARI) a(n)=[1,1,-2,-1,-1,2][n%6+1] \\ _Charles R Greathouse IV_, Jun 02 2011

%o (Magma) &cat [[1, 1, -2, -1, -1, 2]^^20]; // _Wesley Ivan Hurt_, Jun 21 2016

%Y Cf. A061347.

%K sign,easy,less

%O 0,3

%A _Paul Curtz_, Nov 13 2007

%E Comment changed to formula by _Wesley Ivan Hurt_, Jun 21 2016