OFFSET
3,2
COMMENTS
Let {G_n(k)}_(k>=0) be sequence of n-gonal numbers. Then G_n(P_n(k)) = G_n(P_n(k)-1) + G_n((n-2)*k+1).
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 3..1000
Index entries for linear recurrences with constant coefficients, signature (0,0,3,0,0,-3,0,0,1).
FORMULA
If n==0 (mod 3), then a(n) = n^2/9;
if n==1 (mod 3), then a(n) = (n+5)/3;
if n==2 (mod 3), then a(n) = 2.
G.f.: -x^3*(2*x^8+2*x^7-4*x^5-5*x^4+x^3+2*x^2+3*x+1) / ((x-1)^3*(x^2+x+1)^3). - Colin Barker, Jan 23 2014
EXAMPLE
Let n=5, k=4. Then G_5(k)=k*(3*k-1)/2 (Cf. A000326) and the double trinomial 2*P_5(x)= 9*x^2+5*x+2, P_5(4)=(9*4^2+5*4+2)/2=83,
Thus, we have G_5(83)=G_5(82)+G_5(13), or 83*124 = 41*245 + 13*19 = 10292.
MATHEMATICA
a[n_]:=Which[Mod[n, 3]==0, n^2/9, Mod[n, 3]==1, (n+5)/3, True, 2]; Map[a, Range[3, 103]]
CoefficientList[Series[(-1-3 x-2 x^2-x^3+5 x^4+4 x^5-2 x^7-2 x^8)/((-1+x)^3 (1+x+x^2)^3), {x, 0, 100}], x]
PROG
(PARI) Vec(-x^3*(2*x^8+2*x^7-4*x^5-5*x^4+x^3+2*x^2+3*x+1)/((x-1)^3*(x^2+x+1)^3) + O(x^100)) \\ Colin Barker, Jan 23 2014
(Magma) I:=[1, 3, 2, 4, 4, 2, 9, 5, 2]; [n le 9 select I[n] else 3*Self(n-3)-3*Self(n-6)+Self(n-9): n in [1..90]]; // Vincenzo Librandi, Feb 02 2014
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Vladimir Shevelev, Jan 22 2014
STATUS
approved