OFFSET
1,2
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 1..5000
Index entries for linear recurrences with constant coefficients, signature (1,0,1,-1).
FORMULA
From Colin Barker, Mar 13 2012: (Start)
G.f.: x*(4+2*x+x^2)/((1-x)^2*(1+x+x^2)).
a(n) = a(n-1) + a(n-3) - a(n-4) for n>4. (End)
a(n) = Sum_{i=1..n} 2^(-i mod 3). - Wesley Ivan Hurt, Jul 08 2014
From Wesley Ivan Hurt, Jun 10 2016: (Start)
a(n) = (21*n-12+3*cos(2*n*Pi/3)-5*sqrt(3)*sin(2*n*Pi/3))/9.
a(3k) = 7k-1, a(3k-1) = 7k-3, a(3k-2) = 7k-7. (End)
MAPLE
A047289:=n->(21*n-12+3*cos(2*n*Pi/3)-5*sqrt(3)*sin(2*n*Pi/3))/9: seq(A047289(n), n=1..100); # Wesley Ivan Hurt, Jun 10 2016
MATHEMATICA
Cases[Range[0, 123], n_ /; MatchQ[Mod[n, 7], 0 | 4 | 6]] (* Jean-François Alcover, Mar 16 2011 *)
Select[Range[0, 125], MemberQ[{0, 4, 6}, Mod[#, 7]]&] (* Vincenzo Librandi, Apr 26 2012 *)
PROG
(Magma) I:=[0, 4, 6, 7]; [n le 4 select I[n] else Self(n-1)+Self(n-3)-Self(n-4): n in [1..70]]; // Vincenzo Librandi, Apr 26 2012
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
EXTENSIONS
More terms from Wesley Ivan Hurt, Jul 08 2014
STATUS
approved