%I #52 Sep 05 2023 16:57:48
%S 0,2,6,10,16,22,30,38,48,58,70,82,96,110,126,142,160,178,198,218,240,
%T 262,286,310,336,362,390,418,448,478,510,542,576,610,646,682,720,758,
%U 798,838,880,922,966,1010,1056,1102,1150,1198,1248,1298,1350,1402,1456,1510,1566,1622,1680,1738,1798,1858,1920,1982,2046,2110,2176,2242,2310,2378,2448,2518
%N a(n) = n - 1 + ceiling((n^2-2)/2); complement of A183574.
%C Agrees with the circumference of the n X n stacked book graph for n = 2 up to at least n = 8. - _Eric W. Weisstein_, Dec 05 2017
%C It seems that a(n-1) is the maximal length of an optimal solution path required to solve any n X n maze. Here the maze has a single start point, a single end point, and any number of walls that cannot be traversed. The maze is 4-connected, so the allowed moves are: up, down, left and right. For odd n, the hardest mazes have walls located in a spiral, start point in one corner and end point in the center. - _Dmitry Kamenetsky_, Mar 06 2018
%H Colin Barker, <a href="/A183575/b183575.txt">Table of n, a(n) for n = 1..1000</a>
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/GraphCircumference.html">Graph Circumference</a>.
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/StackedBookGraph.html">Stacked Book Graph</a>.
%H <a href="/index/Rec#order_04">Index entries for linear recurrences with constant coefficients</a>, signature (2,0,-2,1).
%F a(n) = n - 1 + ceiling(n^2/2-1).
%F a(n) = A000217(n-2) + A047215(n-1). - _Wesley Ivan Hurt_, Jul 15 2013
%F From _Colin Barker_, Dec 07 2017: (Start)
%F G.f.: 2*x^2*(1 + x - x^2) / ((1 - x)^3*(1 + x)).
%F a(n) = (n^2 + 2*n - 4)/2 for n even.
%F a(n) = (n^2 + 2*n - 3)/2 for n odd.
%F a(n) = 2*a(n-1) - 2*a(n-3) + a(n-4) for n > 4.
%F (End)
%F Sum_{n>=2} 1/a(n) = 7/8 + tan(sqrt(5)*Pi/2)*Pi/(2*sqrt(5)). - _Amiram Eldar_, Sep 16 2022
%F E.g.f.: (4 + (x^2 + 3*x - 4)*cosh(x) + (x^2 + 3*x - 3)*sinh(x))/2. - _Stefano Spezia_, Sep 05 2023
%t Table[Ceiling[n^2/2 - 1] + n - 1, {n, 20}] (* _Eric W. Weisstein_, May 18 2017 *)
%t Table[(2 n (n + 2) - 7 - (-1)^n)/4, {n, 20}] (* _Eric W. Weisstein_, May 18 2017 *)
%t Table[If[Mod[n, 2] == 0, n^2 + 2 n - 4, (n + 3) (n - 1)]/2, {n, 20}] (* _Eric W. Weisstein_, May 18 2017 *)
%t LinearRecurrence[{2,0,-2,1},{0,2,6,10},80] (* _Harvey P. Dale_, Feb 19 2021 *)
%o (PARI) concat(0, Vec(2*x*(1 + x - x^2) / ((1 - x)^3*(1 + x)) + O(x^60))) \\ _Colin Barker_, Dec 07 2017
%Y Cf. A183574 (complement).
%K nonn,easy
%O 1,2
%A _Clark Kimberling_, Jan 05 2011
%E Description corrected by _Eric W. Weisstein_, May 18 2017
%E a(1)=0 inserted by _Amiram Eldar_, Sep 16 2022