OFFSET
1,1
COMMENTS
Odd triangular numbers plus 1.
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 1..10000
Index entries for linear recurrences with constant coefficients, signature (1,2,-2,-1,1).
FORMULA
a(n) = 1 + A014493(n).
a(n) = 2*A174114(n).
G.f.: -2*x*(1+x+4*x^2+x^3+x^4) / ( (1+x)^2*(x-1)^3 ). - R. J. Mathar, Aug 25 2011
From Colin Barker, Jan 27 2016: (Start)
a(n) = (3+(-1)^n-2*(2+(-1)^n)*n+4*n^2)/2.
a(n) = 2*n^2-3*n+2 for n even.
a(n) = 2*n^2-n+1 for n odd.
(End)
MATHEMATICA
Table[(3 + (-1)^n - 2 (2 + (-1)^n) n + 4 n^2)/2, {n, 50}] (* or *)
Select[PolygonalNumber@ Range@ 100, OddQ] + 1 (* Version 10.4, or *)
Table[If[EvenQ@ n, 2 n^2 - 3 n + 2, 2 n^2 - n + 1], {n, 50}] (* or *)
Rest@ CoefficientList[Series[-2 x (1 + x + 4 x^2 + x^3 + x^4)/((1 + x)^2 (x - 1)^3), {x, 0, 50}], x] (* Michael De Vlieger, Jun 30 2016 *)
LinearRecurrence[{1, 2, -2, -1, 1}, {2, 4, 16, 22, 46}, 50] (* Harvey P. Dale, Sep 13 2020 *)
PROG
(Magma) [1+((2*n-1)*(2*n-1-(-1)^n)/2): n in [1..50]]; // Vincenzo Librandi, Aug 18 2011
(PARI) a(n)=(2*n-1)*(2*n-1-(-1)^n)/2+1 \\ Charles R Greathouse IV, Jun 11 2015
(PARI) Vec(2*x*(1+x+4*x^2+x^3+x^4)/((1-x)^3*(1+x)^2) + O(x^100)) \\ Colin Barker, Jan 27 2016
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Omar E. Pol, Aug 15 2011
STATUS
approved