login
a(4*k) = 2*k+1, a(4*k+1) = -4*k-3, a(4*k+2) = 2*k+2, a(4*k+3) = 0.
1

%I #13 Dec 17 2016 17:12:19

%S 1,-3,2,0,3,-7,4,0,5,-11,6,0,7,-15,8,0,9,-19,10,0,11,-23,12,0,13,-27,

%T 14,0,15,-31,16,0,17,-35,18,0,19,-39,20,0,21,-43,22,0,23,-47,24,0,25,

%U -51,26,0,27,-55,28,0,29,-59,30,0,31,-63,32,0,33,-67,34,0,35,-71,36,0,37,-75,38,0,39,-79,40,0,41,-83,42,0,43,-87,44,0

%N a(4*k) = 2*k+1, a(4*k+1) = -4*k-3, a(4*k+2) = 2*k+2, a(4*k+3) = 0.

%H Todd Silvestri, <a href="/A131732/b131732.txt">Table of n, a(n) for n = 0..9999</a>

%H <a href="/index/Rec#order_06">Index entries for linear recurrences with constant coefficients</a>, signature (-2,-3,-4,-3,-2,-1).

%F a(n) = -(n+2)*((-1)^(n+1)+sin(Pi*n/2))/2. - _Todd Silvestri_, Dec 16 2014

%F From _Colin Barker_, Dec 05 2016: (Start)

%F a(n) = -2*a(n-1)-3*a(n-2)-4*a(n-3)-3*a(n-4)-2*a(n-5)-a(n-6) for n>5.

%F G.f.: (1 - x - x^2 - x^3) / ((1 + x)^2*(1 + x^2)^2).

%F (End)

%F a(2*n) = n+1 for all n in Z. - _Michael Somos_, Dec 17 2016

%e G.f. = 1 - 3*x + 2*x^2 + 3*x^4 - 7*x^5 + 4*x^6 + 5*x^8 - 11*x^9 + 6*x^10 + ...

%t a[n_Integer/;n>=0]:=-(n+2) ((-1)^(n+1)+Mod[n^2 (3 n+2),4,-1])/2 (* _Todd Silvestri_, Dec 16 2014 *)

%o (PARI) Vec((1 - x - x^2 - x^3) / ((1 + x)^2*(1 + x^2)^2) + O(x^100)) \\ _Colin Barker_, Dec 05 2016

%o (PARI) {a(n) = [ n\2 + 1, -2 - n, n\2 + 1, 0][n%4 + 1]}; /* _Michael Somos_, Dec 17 2016 */

%o (PARI) {a(n) = if( n%4==3, 0, n%4==1, -2 - n, n/2 + 1)}; /* _Michael Somos_, Dec 17 2016 */

%K sign,easy

%O 0,2

%A _Paul Curtz_, Sep 17 2007