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

%I #38 Sep 24 2022 05:47:34

%S 0,1,2,7,8,17,18,31,32,49,50,71,72,97,98,127,128,161,162,199,200,241,

%T 242,287,288,337,338,391,392,449,450,511,512,577,578,647,648,721,722,

%U 799,800,881,882,967,968,1057,1058,1151,1152,1249,1250,1351

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

%H David Lovler, <a href="/A213037/b213037.txt">Table of n, a(n) for n = 0..10000</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 + x + 3*x^2 - x^3)/((1 - x)^3*(1 + x)^2). [Corrected by _Bruno Berselli_, Sep 16 2014]

%F a(n) = A000290(n) - 2*A008794(n). - _Michel Marcus_, May 27 2022

%F E.g.f.: ((3*x + x^2)*cosh(x) + (-1 + x + x^2)*sinh(x))/2. - _David Lovler_, Jun 20 2022

%F Sum_{n>=1} 1/a(n) = Pi^2/12 - cot(Pi/sqrt(2))*Pi/(2*sqrt(2)) + 1/2. - _Amiram Eldar_, Sep 24 2022

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

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

%t LinearRecurrence[{1,2,-2,-1,1},{0,1,2,7,8},60] (* _Harvey P. Dale_, Oct 06 2016 *)

%o (PARI) a(n) = n^2 - 2*(n\2)^2; \\ _Michel Marcus_, May 25 2022

%Y Cf. A000290, A008794.

%Y Cf. A247375.

%Y Cf. A322630 (diagonal).

%K nonn,easy

%O 0,3

%A _Clark Kimberling_, Jun 06 2012