login
a(n) = n + (n+1) + (n-1) + (n+2) + (n-2) ... n terms.
1

%I #24 Aug 18 2019 01:44:37

%S 1,5,9,18,25,39,49,68,81,105,121,150,169,203,225,264,289,333,361,410,

%T 441,495,529,588,625,689,729,798,841,915,961,1040,1089,1173,1225,1314,

%U 1369,1463,1521,1620,1681,1785,1849,1958,2025,2139,2209,2328,2401,2525

%N a(n) = n + (n+1) + (n-1) + (n+2) + (n-2) ... n terms.

%H Harvey P. Dale, <a href="/A110349/b110349.txt">Table of n, a(n) for n = 1..1000</a>

%H Robert M. Ziff, <a href="http://dx.doi.org/10.1088/0305-4470/28/5/013">On Cardy's formula for the critical crossing probability in 2d percolation</a>, J. Phys. A. 28, 1249-1255 (1995).

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

%F a(2n-1) = (2n-1)^2; a(2n)=4n^2+n. - _Emeric Deutsch_, Aug 03 2005

%F G.f.: x*(1+4*x+2*x^2+x^3)/((1+x)^2*(1-x)^3). - _Bruno Berselli_, Mar 19 2012

%F a(n) = n(4n+(-1)^n+1)/4. - _Bruno Berselli_, Mar 19 2012

%e a(4) = 4+5+3+6 = 18.

%e a(5) = 5+6+4+7+3 = 25.

%p a:=proc(n) if n mod 2 = 0 then n^2+n/2 else n^2 fi end: seq(a(n),n=1..60); # _Emeric Deutsch_, Aug 03 2005

%t f[n_]:=If[OddQ[n],n^2,n/2*(2n+1)]; Array[f, 50] (* _Harvey P. Dale_, Mar 17 2012 *)

%K nonn,easy

%O 1,2

%A _Amarnath Murthy_, Jul 21 2005

%E More terms from _Emeric Deutsch_, Aug 03 2005