login
Even central polygonal numbers.
4

%I #32 Sep 08 2022 08:45:58

%S 2,4,16,22,46,56,92,106,154,172,232,254,326,352,436,466,562,596,704,

%T 742,862,904,1036,1082,1226,1276,1432,1486,1654,1712,1892,1954,2146,

%U 2212,2416,2486,2702,2776,3004,3082,3322,3404,3656,3742,4006,4096,4372

%N Even central polygonal numbers.

%C Odd triangular numbers plus 1.

%H Vincenzo Librandi, <a href="/A193868/b193868.txt">Table of n, a(n) for n = 1..10000</a>

%H <a href="/index/Rec#order_05">Index entries for linear recurrences with constant coefficients</a>, signature (1,2,-2,-1,1).

%F a(n) = A000124(A042963(n-1)).

%F a(n) = 1 + A014493(n).

%F a(n) = 2*A174114(n).

%F 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

%F From _Colin Barker_, Jan 27 2016: (Start)

%F a(n) = (3+(-1)^n-2*(2+(-1)^n)*n+4*n^2)/2.

%F a(n) = 2*n^2-3*n+2 for n even.

%F a(n) = 2*n^2-n+1 for n odd.

%F (End)

%t Table[(3 + (-1)^n - 2 (2 + (-1)^n) n + 4 n^2)/2, {n, 50}] (* or *)

%t Select[PolygonalNumber@ Range@ 100, OddQ] + 1 (* Version 10.4, or *)

%t Table[If[EvenQ@ n, 2 n^2 - 3 n + 2, 2 n^2 - n + 1], {n, 50}] (* or *)

%t 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 *)

%t LinearRecurrence[{1,2,-2,-1,1},{2,4,16,22,46},50] (* _Harvey P. Dale_, Sep 13 2020 *)

%o (Magma) [1+((2*n-1)*(2*n-1-(-1)^n)/2): n in [1..50]]; // _Vincenzo Librandi_, Aug 18 2011

%o (PARI) a(n)=(2*n-1)*(2*n-1-(-1)^n)/2+1 \\ _Charles R Greathouse IV_, Jun 11 2015

%o (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

%Y Cf. A000124, A193867.

%K nonn,easy

%O 1,1

%A _Omar E. Pol_, Aug 15 2011