login
a(n) = n^2 - 3*floor(n/2)^2.
1

%I #17 Sep 22 2019 12:52:32

%S 0,1,1,6,4,13,9,22,16,33,25,46,36,61,49,78,64,97,81,118,100,141,121,

%T 166,144,193,169,222,196,253,225,286,256,321,289,358,324,397,361,438,

%U 400,481,441,526,484,573,529,622,576,673,625,726,676,781,729,838

%N a(n) = n^2 - 3*floor(n/2)^2.

%H Colin Barker, <a href="/A213038/b213038.txt">Table of n, a(n) for n = 0..1000</a>

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

%F a(n) = a(n-1) + 2*a(n-2) - 2*a(n-3) - a(n-4) + a(n-5).

%F G.f.: x*(1+3*x^2-2*x^3) / ((1-x)^3*(1+x)^2). [Corrected by _Colin Barker_, Jan 26 2016]

%F a(n) = ( 2*n*(n+3) - 3*(2*n-1)*(-1)^n - 3 )/8. [_Bruno Berselli_, Jan 26 2016]

%t a[n_] := n^2 - 3 Floor[n/2]^2

%t Table[a[n], {n, 0, 90}] (* A213038 *)

%t LinearRecurrence[{1,2,-2,-1,1},{0,1,1,6,4},60] (* _Harvey P. Dale_, Sep 22 2019 *)

%o (PARI) concat(0, Vec(x*(1+3*x^2-2*x^3)/((1-x)^3*(1+x)^2) + O(x^100))) \\ _Colin Barker_, Jan 26 2016

%K nonn,easy

%O 0,4

%A _Clark Kimberling_, Jun 06 2012