A154127 Period 6: repeat [1, 2, 5, 8, 7, 4].
1, 2, 5, 8, 7, 4, 1, 2, 5, 8, 7, 4, 1, 2, 5, 8, 7, 4, 1, 2, 5, 8, 7, 4, 1, 2, 5, 8, 7, 4, 1, 2, 5, 8, 7, 4, 1, 2, 5, 8, 7, 4, 1, 2, 5, 8, 7, 4, 1, 2, 5, 8, 7, 4, 1, 2, 5, 8, 7, 4, 1, 2, 5, 8, 7, 4, 1, 2, 5, 8, 7, 4, 1, 2, 5, 8, 7, 4, 1, 2, 5, 8, 7, 4, 1, 2
Offset: 0
Links
- Index entries for linear recurrences with constant coefficients, signature (1,0,-1,1).
Programs
-
Magma
&cat[[1, 2, 5, 8, 7, 4]: n in [0..20]]; // Wesley Ivan Hurt, Jun 17 2016
-
Maple
A154127:=n->(27-cos(n*Pi)-20*cos(n*Pi/3)-4*sqrt(3)*sin(n*Pi/3))/6: seq(A154127(n), n=0..100); # Wesley Ivan Hurt, Jun 17 2016
-
Mathematica
Flatten[Table[{1, 2, 5, 8, 7, 4}, {20}]] (* Wesley Ivan Hurt, Jun 17 2016 *)
-
PARI
a(n)=[1,2,5,8,7,4][n%6+1] \\ Charles R Greathouse IV, Jun 02 2011
Formula
From R. J. Mathar, Feb 25 2009, Mar 09 2009: (Start)
a(n) = a(n-1) - a(n-3) + a(n-4) for n>3.
G.f.: (1+x+3*x^2+4*x^3)/((1-x)*(1+x)*(x^2-x+1)). (End)
a(n) = (27-cos(n*Pi)-20*cos(n*Pi/3)-4*sqrt(3)*sin(n*Pi/3))/6. - Wesley Ivan Hurt, Jun 17 2016
Extensions
Corrected numerator in g.f R. J. Mathar, Mar 09 2009