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,0,1,-1).
FORMULA
a(n) = ceiling(floor((7*n - 5)/2)/2).
From Colin Barker, Mar 14 2012: (Start)
a(n) = a(n-1) + a(n-4) - a(n-5) for n>5.
G.f.: x*(1 + x + 2*x^2 + 2*x^3 + x^4)/((1-x)^2*(1+x)*(1+x^2)). (End)
a(n) = (-9 -(-1)^n + (1+i)*(-i)^n + (1-i)*i^n + 14*n)/8 where i=sqrt(-1). - Colin Barker, May 14 2012
E.g.f.: (4 + sin(x) + cos(x) + (7*x - 4)*sinh(x) + (7*x - 5)*cosh(x))/4. - Ilya Gutkovskiy, Jun 01 2016
MAPLE
MATHEMATICA
Select[Range[0, 100], MemberQ[{1, 2, 4, 6}, Mod[#, 7]]&] (* Vincenzo Librandi, Apr 27 2012 *)
LinearRecurrence[{1, 0, 0, 1, -1}, {1, 2, 4, 6, 8}, 100] (* G. C. Greubel, Jun 01 2016 *)
PROG
(Magma) I:=[1, 2, 4, 6, 8]; [n le 5 select I[n] else Self(n-1)+Self(n-4)-Self(n-5): n in [1..70]]; // Vincenzo Librandi, Apr 27 2012
(PARI) x='x+O('x^100); Vec(x*(1+x+2*x^2+2*x^3+x^4)/((1-x)^2*(1+x)*(1+x^2))) \\ Altug Alkan, Dec 24 2015
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
STATUS
approved