OFFSET
0,2
COMMENTS
a(n) gives the number of hexagons that have vertices at the lattice points and sides on lattice lines of a triangular lattice with sides n+3. Note that the hexagons can be non-regular. This problem appeared as ConvexHexagons in Single Round Match 455 in TopCoder. - Dmitry Kamenetsky, Dec 17 2009
LINKS
G. C. Greubel, Table of n, a(n) for n = 0..1000
Jun-Ming Zhu, The number of convex pentagons and hexagons in an n-triangular net, arXiv:1012.4058 [math.CO], 2010; See H(n), formula 3, on page 4.
Index entries for linear recurrences with constant coefficients, signature (6,-14,14,0,-14,14,-6,1).
FORMULA
From G. C. Greubel, Jul 02 2021: (Start)
a(n) = (1/1920)*(4*n^6 +72*n^5 +530*n^4 +2040*n^3 +4296*n^2 +4608*n +1905 +15*(-1)^n).
a(2*n+1) = (1/15)*binomial(n+2, 2)*binomial(n+3, 2)*(8*n^2 + 32*n + 35).
a(2*n) = (1/30)*binomial(n+2, 2)*(8*n^4 + 48*n^3 + 105*n^2 + 99*n + 30).
G.f.: (1 - x^3)/((1-x^2)*(1-x)^7).
E.g.f.: (1/1920)*((1905 +2*x*(5775 +7665*x +3690*x^2 +755*x^3 +66*x^4 +2*x^5))*exp(x) + 15*exp(-x)). (End)
MATHEMATICA
LinearRecurrence[{6, -14, 14, 0, -14, 14, -6, 1}, {1, 7, 29, 90, 232, 524, 1072, 2030}, 51] (* G. C. Greubel, Jul 02 2021 *)
PROG
(Magma)
R<x>:=PowerSeriesRing(Integers(), 50);
Coefficients(R!( (1-x^3)/((1-x^2)*(1-x)^7) )); // G. C. Greubel, Jul 02 2021
(Sage)
def a(n): return (n+2)*(n+4)*(2*n^4 +24*n^3 +105*n^2 +198*n +120)/960 if (n%2==0) else (n+1)*(n+3)^2*(n+5)*(2*n*(n+6) +21)/960
[a(n) for n in (0..50)] # G. C. Greubel, Jul 02 2021
(PARI) \\ using Zhu expressions
f(k) = (8*k^6 + 24*k^5 + 25*k^4 + 10*k^3 - 3*k^2 -4*k)/60;
g(k) = (8*k^6 - 5*k^4 - 3*k^2)/60;
a(n) = n+=3; if (n%2, f((n-1)/2), g(n/2)); \\ Michel Marcus, Jul 04 2021
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
R. H. Hardin, Oct 09 2009
STATUS
approved