%I #26 Sep 08 2017 13:35:53
%S 1,4,8,16,26,42,61,88,119,160,206,264,328,406,491,592,701,828,964,
%T 1120,1286,1474,1673,1896,2131,2392,2666,2968,3284,3630,3991,4384,
%U 4793,5236,5696,6192,6706,7258,7829,8440,9071,9744,10438,11176,11936,12742,13571,14448
%N Wiener index of the n-pan graph.
%C The n-pan graph is obtained by joining with an edge a node in the cycle graph C_n to the singleton graph P_1. The Wiener index of a connected graph is the sum of distances between all unordered pairs of vertices in the graph.
%C The n-pan graph is a special case of the tadpole graph.
%C Extended to a(1)-a(2) using the formula/recurrence.
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/PanGraph.html">Pan Graph</a>
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/TadpoleGraph.html">Tadpole Graph</a>
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/WienerIndex.html">Wiener Index</a>
%H <a href="/index/Rec#order_06">Index entries for linear recurrences with constant coefficients</a>, signature (2,1,-4,1,2,-1).
%F a(n) = A180860(n,1) for n>2.
%F a(n) = (1/8)*n*(n^2 + 2*n + 8) if n is even; a(n) = (1/8)*(n^3 + 2*n^2 + 7*n - 2) if n is odd.
%F From _R. J. Mathar_, Sep 29 2010: (Start)
%F a(n) = +2*a(n-1) +a(n-2) -4*a(n-3) +a(n-4) +2*a(n-5) -a(n-6).
%F G.f.: x*(1 + 2*x - x^2 + x^4)/((1 - x)^4*(1 + x)^2). (End)
%F a(n) = (-2 + 15*n + 4*n^2 + 2*n^3 + (-1)^n*(2 + n))/16. - _Eric W. Weisstein_, Sep 08 2017
%e a(3)=8 because the graph consists of a triangle ABCA and an edge AD; the distances are d(A,B)=d(B,C)=d(C,A)=d(A,D)=1 and d(DB)=d(DC)=2.
%p a := proc (n) if `mod`(n, 2) = 0 then (1/8)*n*(n^2+2*n+8) else (1/8)*n^3+(1/4)*n^2+(7/8)*n-1/4 end if end proc: seq(a(n), n = 1 .. 50);
%t LinearRecurrence[{2, 1, -4, 1, 2, -1}, {1, 4, 8, 16, 26, 42}, 50] (* _Harvey P. Dale_, Jun 04 2015 *)
%t Table[(-2 + 15 n + 4 n^2 + 2 n^3 + (-1)^n (2 + n))/16, {n, 20}] (* _Eric W. Weisstein_, Sep 08 2017 *)
%t CoefficientList[Series[(1 + 2 x - x^2 + x^4)/((1 - x)^4 (1 + x)^2), {x, 0, 20}], x] (* _Eric W. Weisstein_, Sep 08 2017 *)
%Y First column of A180860.
%K nonn,easy
%O 1,2
%A _Emeric Deutsch_, Sep 27 2010
%E a(1)-a(2) and new offset from _Eric W. Weisstein_, Sep 08 2017
|