%I #42 Sep 09 2023 10:05:41
%S -1,0,2,6,11,18,26,36,47,60,74,90,107,126,146,168,191,216,242,270,299,
%T 330,362,396,431,468,506,546,587,630,674,720,767,816,866,918,971,1026,
%U 1082,1140,1199,1260,1322,1386,1451,1518,1586,1656,1727,1800,1874,1950,2027
%N a(n) = (-7 + (-1)^(1+n) + 6*n^2) / 8.
%C a(n+1) is once in the hexagonal spiral in A330707. a(n+2) is twice in the same spiral.
%C a(n) has one odd followed by three evens.
%C Difference table:
%C -1, 0, 2, 6, 11, 18, 26, 36, ... = a(n)
%C 1, 2, 4, 5, 7, 8, 10, 11, ... = A001651(n+1)
%C 1, 2, 1, 2, 1, 2, 1, 2, ... = A000034.
%H Colin Barker, <a href="/A331952/b331952.txt">Table of n, a(n) for n = 0..1000</a>
%H <a href="/index/Rec#order_04">Index entries for linear recurrences with constant coefficients</a>, signature (2,0,-2,1).
%H <a href="/index/Tu#2wis">Index entries for two-way infinite sequences</a>
%F a(-n) = a(n).
%F a(20+n) - a(n) = 30*(10+n).
%F a(2+n) = a(n) + 3*(1+n), a(0)=-1 and a(1)=0.
%F a(4*n) = 12*n^2 - 1, a(1+4*n) = 6*n*(1+2*n), a(2+4*n) = 2 + 12*n*(1+n), a(3+4*n) = 6*(1+n)*(1+2*n) for n>= 0.
%F From _Colin Barker_, Feb 02 2020: (Start)
%F G.f.: -(1 - 2*x - 2*x^2) / ((1 - x)^3*(1 + x)).
%F a(n) = 2*a(n-1) - 2*a(n-3) + a(n-4) for n>3.
%F a(n) = (-7 + (-1)^(1+n) + 6*n^2) / 8.
%F (End)
%F E.g.f.: (1/8)*(exp(x)*(6*x^2 + 6*x - 7) - exp(-x)). - _Stefano Spezia_, Feb 02 2020 after _Colin Barker_
%F a(n) = floor((n^2 - 1)*3/4). - _Michael Somos_, Sep 09 2023
%e G.f. = -1 + 2*x^2 + 6*x^3 + 11*x^4 + 18*x^5 + 26*x^6 + 36*x^7 + 47*x^8 + ... - _Michael Somos_, Sep 08 2023
%t LinearRecurrence[{2, 0, -2, 1}, {-1, 0, 2, 6}, 100] (* _Amiram Eldar_, Feb 02 2020 *)
%t a[n_] := Floor[(n^2 - 1)*3/4]; (* _Michael Somos_, Sep 08 2023 *)
%o (Magma) a:=[-1,0,2,6]; [n le 4 select a[n] else 2*Self(n-1)-2*Self(n-3)+Self(n-4): n in [1..45]]; // _Marius A. Burtea_, Feb 02 2020
%o (PARI) Vec(-(1 - 2*x - 2*x^2) / ((1 - x)^3*(1 + x)) + O(x^40)) \\ _Colin Barker_, Feb 03 2020
%o (PARI) {a(n) = (n^2 - 1)*3\4}; /* _Michael Somos_, Sep 08 2023 */
%Y Cf. A000034, A001651, A158463, 6*A014105, 2*A003154, A152746(n+1), A008585(1+n).
%Y Equals 2 less than A084684, 1 less than A077043, and 1 more than A276382(n-1). - _Greg Dresden_, Feb 22 2020
%K sign,easy
%O 0,3
%A _Paul Curtz_, Feb 02 2020
%E a(42)-a(52) from _Stefano Spezia_, Feb 02 2020