OFFSET
1,2
LINKS
G. C. Greubel, Table of n, a(n) for n = 1..1000
Index entries for linear recurrences with constant coefficients, signature (4,-6,4,-1).
FORMULA
a(n) = (1/2)*(n^3 - 6*n^2 + 13*n - 6).
G.f.: x*(1 - 2*x + x^2 + 3*x^3) / (1-x)^4.
a(n) = 4*a(n-1) - 6*a(n-2) + 4*a(n-3) - a(n-4). - G. C. Greubel, Feb 19 2017
From G. C. Greubel, Mar 18 2025: (Start)
E.g.f.: 3 - (1/2)*(6 - 8*x + 3*x^2 - x^3)*exp(x). (End)
MATHEMATICA
Table[((n-2)^3+n+2)/2, {n, 50}] (* or *) LinearRecurrence[{4, -6, 4, -1}, {1, 2, 3, 7}, 50] (* G. C. Greubel, Feb 19 2017; Mar 18 2025 *)
PROG
(PARI) my(x='x+O('x^50)); Vec(x*(1 - 2*x + x^2 + 3*x^3) / (1-x)^4) \\ G. C. Greubel, Feb 19 2017
(PARI) a(n)=(n^3 - 6*n^2 + 13*n - 6)/2 \\ Charles R Greathouse IV, Feb 19 2017
(Magma)
A158498:= func< n | ((n-2)^3+n+2)/2 >;
[A158498(n): n in [1..50]]; // G. C. Greubel, Mar 18 2025
(SageMath)
def A158498(n): return ((n-2)^3 +n+2)//2
print([A158498(n) for n in range(1, 51)]) # G. C. Greubel, Mar 18 2025
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Alexander R. Povolotsky, Jan 13 2011
STATUS
approved
