A288918 Number of 4-cycles in the n X n king graph.
0, 3, 29, 79, 153, 251, 373, 519, 689, 883, 1101, 1343, 1609, 1899, 2213, 2551, 2913, 3299, 3709, 4143, 4601, 5083, 5589, 6119, 6673, 7251, 7853, 8479, 9129, 9803, 10501, 11223, 11969, 12739, 13533, 14351, 15193, 16059, 16949, 17863
Offset: 1
Links
- Colin Barker, Table of n, a(n) for n = 1..1000
- Eric Weisstein's World of Mathematics, Graph Cycle
- Eric Weisstein's World of Mathematics, King Graph
- Index entries for linear recurrences with constant coefficients, signature (3,-3,1).
Programs
-
Mathematica
Table[If[n == 1, 0, 23 - 34 n + 12 n^2], {n, 20}] Join[{0}, LinearRecurrence[{3, -3, 1}, {1, 3, 29}, {2, 20}]] CoefficientList[Series[(-3 x - 20 x^2 - x^3)/(-1 + x)^3, {x, 0, 20}],x]
-
PARI
a(n)=if(n, 12*n^2-10*n+1, 0) \\ Charles R Greathouse IV, Jun 19 2017
-
PARI
concat(0, Vec(x^2*(3 + 20*x + x^2) / (1 - x)^3 + O(x^40))) \\ Colin Barker, Mar 11 2019
Formula
a(n) = 12*n^2 - 34*n + 23 for n > 1. - Andrew Howroyd, Jun 19 2017
From Colin Barker, Mar 11 2019: (Start)
G.f.: x^2*(3 + 20*x + x^2) / (1 - x)^3.
a(n) = 3*a(n-1) - 3*a(n-2) + a(n-3) for n > 4. (End)
E.g.f.: exp(x)*(23 - 22*x + 12*x^2) - 23 - x. - Stefano Spezia, Aug 14 2022