OFFSET
1,2
COMMENTS
Also, numbers of the form m*(8*m + 3) for m = 0, -1, 1, -2, 2, -3, 3, ... - Bruno Berselli, Feb 26 2018
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
G.f.: x^2*(5 + 6*x + 5*x^2) / ((1 - x)^3*(1 + x)^2).
a(n) = a(n-1) + 2*a(n-2) - 2*a(n-3) - a(n-4) + a(n-5) for n>5.
a(n) = A057029(n) - 1.
a(n) = (1 - (-1)^n + 2*(-4 + (-1)^n)*n + 8*n^2)/4.
a(n) = (4*n^2 - 3*n)/2 for n even, a(n) = (4*n^2 - 5*n + 1)/2 for n odd.
EXAMPLE
5 is in the sequence since 4*5 + 1 = 21 is a triangular number (21 = 1 + 2 + 3 + 4 + 5 + 6). - Michael B. Porter, Jul 03 2016
MAPLE
A274681:=n->(1-(-1)^n+2*(-4+(-1)^n)*n+8*n^2)/4: seq(A274681(n), n=1..100); # Wesley Ivan Hurt, Jul 02 2016
MATHEMATICA
Rest@ CoefficientList[Series[x^2 (5 + 6 x + 5 x^2)/((1 - x)^3 (1 + x)^2), {x, 0, 48}], x] (* Michael De Vlieger, Jul 02 2016 *)
Select[Range[0, 5000], OddQ[Sqrt[8(4#+1)+1]]&] (* or *) LinearRecurrence[ {1, 2, -2, -1, 1}, {0, 5, 11, 26, 38}, 50] (* Harvey P. Dale, Apr 21 2018 *)
PROG
(PARI) isok(n) = ispolygonal(4*n+1, 3)
(PARI) select(n->ispolygonal(4*n+1, 3), vector(10000, n, n-1))
(PARI) concat(0, Vec(x^2*(5+6*x+5*x^2)/((1-x)^3*(1+x)^2) + O(x^100)))
(Magma) [(1-(-1)^n+2*(-4+(-1)^n)*n+8*n^2)/4: n in [1..80]]; // Wesley Ivan Hurt, Jul 02 2016
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Colin Barker, Jul 02 2016
STATUS
approved