OFFSET
1,1
LINKS
Colin Barker, Table of n, a(n) for n = 1..1000
Index entries for linear recurrences with constant coefficients, signature (1,2,-2,-1,1).
FORMULA
a(n) = (5+3*(-1)^n-2*(8+3*(-1)^n)*n+16*n^2)/4.
a(n) = (8*n^2-11*n+4)/2 for n even.
a(n) = (8*n^2-5*n+1)/2 for n odd.
a(n) = a(n-1)+2*a(n-2)-2*a(n-3)-a(n-4)+a(n-5) for n>5.
G.f.: x*(2+5*x+18*x^2+5*x^3+2*x^4) / ((1-x)^3*(1+x)^2).
EXAMPLE
2 is in the sequence since 8*2 - 1 = 15, and 15 = 1 + 2 + 3 + 4 + 5 is a triangular number. - Michael B. Porter, Jul 03 2016
MATHEMATICA
Table[(5 + 3 (-1)^n - 2 (8 + 3 (-1)^n) n + 16 n^2)/4, {n, 47}] (* or *)
Rest@ CoefficientList[Series[x (2 + 5 x + 18 x^2 + 5 x^3 + 2 x^4)/((1 - x)^3 (1 + x)^2), {x, 0, 47}], x] (* Michael De Vlieger, Jul 02 2016 *)
PROG
(PARI) isok(n) = ispolygonal(8*n-1, 3)
(PARI) select(n->ispolygonal(8*n-1, 3), vector(10000, n, n-1))
(PARI) Vec(x*(2+5*x+18*x^2+5*x^3+2*x^4)/((1-x)^3*(1+x)^2) + O(x^100))
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Colin Barker, Jul 02 2016
STATUS
approved