OFFSET
1,2
COMMENTS
The sum of every three consecutive terms is equal to the cube of the index of the middle one, i.e., a(n-1) + a(n) + a(n+1) = n^3.
LINKS
Index entries for linear recurrences with constant coefficients, signature (3,-3,2,-3,3,-1).
FORMULA
G.f.: x*(2*x^5 - 7*x^4 + 9*x^3 + 2*x^2 - x + 1)/((x^2 + x + 1)*(x - 1)^4).
a(n) = (A242135(n) - 6*cos(2*n*Pi/3) + 2*sin(2*n*Pi/3)/sqrt(3))/3. - Stefano Spezia, Mar 04 2023
EXAMPLE
a(5) = (5-1)^3 - a(4) - a(3) = 4^3 - 20 - 5 = 64 - 20 - 5 = 39.
MATHEMATICA
a[1] = 1; a[2] = 2; a[n_] := a[n] = (n - 1)^3 - a[n - 1] - a[n - 2]; Array[a, 45] (* Amiram Eldar, Mar 03 2023 *)
PROG
(PARI) lista(nn) = my(va = vector(nn)); va[1] = 1; va[2] = 2; for (n=3, nn, va[n] = (n-1)^3 - va[n-1] - va[n-2]; ); va; \\ Michel Marcus, Mar 03 2023
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Tamas Sandor Nagy, Mar 02 2023
STATUS
approved