A167380 a(1)=1, a(2)=2, and continued periodically with 4, 5, 1, -4, -5, -1 .
1, 2, 4, 5, 1, -4, -5, -1, 4, 5, 1, -4, -5, -1, 4, 5, 1, -4, -5, -1, 4, 5, 1, -4, -5, -1, 4, 5, 1, -4, -5, -1, 4, 5, 1, -4, -5, -1, 4, 5, 1, -4, -5, -1, 4, 5, 1, -4, -5, -1, 4, 5, 1, -4, -5, -1, 4, 5, 1, -4, -5, -1, 4, 5, 1, -4, -5, -1, 4, 5, 1, -4, -5, -1, 4, 5, 1, -4, -5, -1, 4, 5, 1, -4, -5
Offset: 1
Links
- Index entries for linear recurrences with constant coefficients, signature (1,-1).
Programs
-
Maple
A167380 := proc(n) if n <= 2 then n; else op(1+ (n mod 6),[-4,-5,-1,4,5,1]) ; end if; end proc: seq(A167380(n),n=1..120) ; # R. J. Mathar, Nov 02 2009
-
Mathematica
PadRight[{1,2},120,{-5,-1,4,5,1,-4}] (* or *) Join[{1,2},LinearRecurrence[ {1,-1},{4,5},120]] (* Harvey P. Dale, Mar 08 2015 *)
Formula
a(1)=1. a(2)=2. a(6k-3)=4. a(6k-2)=5. a(6k-1)=1. a(6k)=-4. a(6k+1)=-5. a(6k+2)=-1.
From R. J. Mathar, Nov 03 2009: (Start)
a(n) = a(n-1) - a(n-2), n > 4.
G.f.: x*(1+x)*(3*x^2+1)/(1-x+x^2). (End)
Extensions
Unrelated material removed, and values corrected according to definition, by R. J. Mathar, Nov 05 2009