OFFSET
1,2
COMMENTS
Complement of A047415.
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 1..1000
Index entries for linear recurrences with constant coefficients, signature (2,-2,2,-1).
FORMULA
From Colin Barker, May 14 2012: (Start)
a(n) = (1/4+i/4)*((-3+3*i)-i*(-i)^n+i^n+(4-4*i)*n) where i=sqrt(-1).
G.f.: x^2*(2+x+x^2)/((1-x)^2*(1+x^2)). (End)
a(n) = 2*a(n-1) - 2*a(n-2) + 2*a(n-3) - a(n-4) for n>4. - Vincenzo Librandi, May 16 2012
a(n) = (-1*((-1)^((n-1)/2-(-1)^n/4-1/4)))/2+2*(n-1)+1/2.
a(n) = cos(n*Pi/2)-1/2*cos((n-1)*Pi/2)-1/2*cos(n*Pi/2)+2*(n-1)+1/2. - Cédric Christian Bernard Gagneux, Mar 05 2014
E.g.f.: (2 - sin(x) + cos(x) + (4*x - 3)*exp(x))/2. - Ilya Gutkovskiy, Jun 02 2016
Sum_{n>=2} (-1)^n/a(n) = (3-sqrt(2))*log(2)/8 + sqrt(2)*log(2+sqrt(2))/4 - Pi/16. - Amiram Eldar, Dec 21 2021
MAPLE
A047481:=n->(-1*((-1)^((n-1)/2-(-1)^n/4-1/4)))/2+2*(n-1)+1/2: seq(A047481(n), n=1..100); # Wesley Ivan Hurt, Jun 01 2016
MATHEMATICA
Select[Range[0, 300], MemberQ[{0, 2, 5, 7}, Mod[#, 8]]&] (* Vincenzo Librandi, May 16 2012 *)
LinearRecurrence[{2, -2, 2, -1}, {0, 2, 5, 7}, 70] (* Harvey P. Dale, May 28 2017 *)
PROG
(Magma) I:=[0, 2, 5, 7, 8]; [n le 5 select I[n] else Self(n-1)+Self(n-4)-Self(n-5): n in [1..70]]; // Vincenzo Librandi, May 16 2012
(PARI) a(n)=[-1, 0, 2, 5][n%4]+n\4*8 \\ Charles R Greathouse IV, Mar 05 2014
(PARI) x='x+O('x^100); concat(0, Vec(x^2*(2+x+x^2)/((1-x)^2*(1+x^2)))) \\ Altug Alkan, Dec 24 2015
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
STATUS
approved