%I #49 Aug 24 2024 13:31:40
%S 0,3,10,22,41,68,105,153,214,289,380,488,615,762,931,1123,1340,1583,
%T 1854,2154,2485,2848,3245,3677,4146,4653,5200,5788,6419,7094,7815,
%U 8583,9400,10267,11186,12158,13185,14268,15409,16609,17870,19193,20580,22032
%N a(n) = ( 2*n*(2*n^2 + 9*n + 14) + (-1)^n - 1 )/16.
%C Consider a grid of small triangles of side 1 forming a regular polygon with side n*(n+2); a(n) is the number of equilateral triangles of side length >= 1 in this figure which are oriented with the sides of the figure.
%C This sequence gives the number of triangles of all sizes in a (n^2+2*n)-iamond with a 4*n-gon configuration.
%C Equals (1/2)*Sum_{j=0..n-1} (n-j)*(n+1-j) + (-1 + (1/8)*Sum_{j=0..(2*n+1-(-1)^n)/4} (2*n+3+(-1)^n-4*j)*(2*n+3-(-1)^n-4*j)) numbers of triangles in a direction and in the opposite direction.
%H Colin Barker, <a href="/A248851/b248851.txt">Table of n, a(n) for n = 0..1000</a>
%H Luce ETIENNE, <a href="/A248851/a248851.pdf">Illustration for a(1), a(2), a(3), a(4), a(5)</a>
%H <a href="/index/Rec#order_05">Index entries for linear recurrences with constant coefficients</a>, signature (3,-2,-2,3,-1).
%F G.f.: x*(x^3-2*x^2+x+3) / ((x-1)^4*(x+1)). - _Colin Barker_, Mar 03 2015
%F a(n) = 3*a(n-1)-2*a(n-2)-2*a(n-3)+3*a(n-4)-a(n-5). - _Colin Barker_, Mar 03 2015
%e From third comment: a(0)=0, a(1)=1+2, a(2)=4+6, a(3)=10+12, a(4)=20+21, a(5)=35+33.
%t CoefficientList[Series[x (x^3 - 2 x^2 + x + 3) / ((x - 1)^4(x + 1)), {x, 0, 50}], x] (* _Vincenzo Librandi_, Mar 21 2015 *)
%t LinearRecurrence[{3,-2,-2,3,-1},{0,3,10,22,41},50] (* _Harvey P. Dale_, Jan 17 2023 *)
%o (PARI) concat(0, Vec(x*(x^3-2*x^2+x+3)/((x-1)^4*(x+1)) + O(x^100))) \\ _Colin Barker_, Mar 03 2015
%o (Magma) [(4*n^3+18*n^2+28*n-(1-(-1)^n)) div 16: n in [0..50]]; // _Vincenzo Librandi_, Mar 21 2015
%Y Cf. A117143, A000292, A002623, A045947, A005563, A008586.
%K nonn,easy
%O 0,2
%A _Luce ETIENNE_, Mar 03 2015
%E Typo in formula fixed by _Vincenzo Librandi_, Mar 21 2015
%E Name rewritten using the closed form by _Bruno Berselli_, Apr 19 2015