OFFSET
0,3
LINKS
Colin Barker, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (5,-9,7,-2).
FORMULA
a(n) = 2*a(n - 1) + ((n - 3)^2 + 3(n - 3)) = 2*a(n - 1) + A028552(n - 3) for n > 4.
a(n) = (2*a(n-1) + 7*a(n-2))*2 = A015519/2 for n > 4.
From Colin Barker, Aug 16 2017: (Start)
G.f.: (1 - 5*x + 7*x^2 - x^3) / ((1 - x)^3*(1 - 2*x)).
a(n) = 5*a(n-1) - 9*a(n-2) + 7*a(n-3) - 2*a(n-4) for n>3.
(End)
EXAMPLE
a(3) = -4 because 2^3 - 3^2 - 3 = 8 - 9 - 3 = -4.
a(4) = -4 because 2^4 - 4^2 - 4 = 16 - 16 - 4 = -4.
a(5) = 2 because 2^5 - 5^2 - 5 = 32 - 25 - 5 = 2.
a(6) = 22 because 2^6 - 6^2 - 6 = 64 - 36 - 6 = 22.
MATHEMATICA
Table[2^n - n^2 - n, {n, 0, 32}] (* Alonso del Arte, Dec 16 2012 *)
PROG
(PARI) Vec((1 - 5*x + 7*x^2 - x^3) / ((1 - x)^3*(1 - 2*x)) + O(x^40)) \\ Colin Barker, Aug 16 2017
CROSSREFS
KEYWORD
sign,easy
AUTHOR
Dario Piazzalunga, Dec 16 2012
EXTENSIONS
a(3) corrected by Charles A. Dagino, Aug 16 2017
STATUS
approved