%I #55 Jul 07 2023 14:57:19
%S 0,6,38,116,262,496,840,1314,1940,2738,3730,4936,6378,8076,10052,
%T 12326,14920,17854,21150,24828,28910,33416,38368,43786,49692,56106,
%U 63050,70544,78610,87268,96540,106446,117008,128246,140182,152836,166230,180384,195320,211058
%N Number of equilateral triangles formed out of matches that can be found in a hexagonal chunk of side length n in hexagonal array of matchsticks.
%H N. J. A. Sloane, <a href="/A045949/a045949.jpg">Illustration of a(1)=6</a>
%H <a href="/index/Rec#order_05">Index entries for linear recurrences with constant coefficients</a>, signature (3,-2,-2,3,-1). [From _R. J. Mathar_, Sep 03 2010]
%F a(n) = floor(n*(14*n^2 + 9*n + 2)/4).
%F From _R. J. Mathar_, Sep 03 2010: (Start)
%F a(n) = +3*a(n-1) -2*a(n-2) -2*a(n-3) +3*a(n-4) -a(n-5).
%F G.f.: 2*x*(3+10*x+7*x^2+x^3) / ( (1+x)*(1-x)^4 ).
%F a(n) = (28*n^3 + 18*n^2 + 4*n - 1 + (-1)^n)/8. (End)
%F a(n) = A033581(n) + A307253(n). - _John King_, Apr 04 2019
%F E.g.f.: (x*(25 + 51*x + 14*x^2)*exp(x) - sinh(x))/4. - _G. C. Greubel_, Apr 05 2019
%t LinearRecurrence[{3,-2,-2,3,-1},{0,6,38,116,262},40] (* or *) CoefficientList[Series[(2*x*(x*(x+2)*(x+5)+3))/((x-1)^4*(x+1)),{x,0,40}],x] (* _Harvey P. Dale_, Jun 11 2011 *)
%o (Maxima) A045949(n):=floor(n*(14*n^2+9*n+2)/4)$
%o makelist(A045949(n),n,0,30); /* _Martin Ettl_, Nov 03 2012 */
%o (R) floor(1:25*(14*(1:25)^2+9*(1:25)+2)/4) # _Christian N. K. Anderson_, Apr 27 2013
%o (PARI) {a(n) = (28*n^3 +18*n^2 +4*n -1 +(-1)^n)/8}; \\ _G. C. Greubel_, Apr 05 2019
%o (Magma) [(28*n^3 +18*n^2 +4*n -1 +(-1)^n)/8: n in [0..40]]; // _G. C. Greubel_, Apr 05 2019
%o (Sage) [(28*n^3 +18*n^2 +4*n -1 +(-1)^n)/8 for n in (0..40)] # _G. C. Greubel_, Apr 05 2019
%o (GAP) List([0..40], n-> (28*n^3 +18*n^2 +4*n -1 +(-1)^n)/8) # _G. C. Greubel_, Apr 05 2019
%Y See A008893 for a related sequence.
%Y For hexagons, the number of matches required is A045945, the number of size=1 triangles is A033581, the larger triangles is A307253 and the total number is A045949. For the analogs for triangles see A045943 and for stars see A045946. - _John King_, Apr 05 2019
%K nonn
%O 0,2
%A _R. K. Guy_
%E Edited by _N. J. A. Sloane_, May 29 2012