OFFSET
0,3
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 0..400
Index entries for linear recurrences with constant coefficients, signature (3,-2,-1,1).
FORMULA
Periodic mod 6.
G.f.: (1 - 2*x + 3*x^2 - x^3) / ((1 - x - x^2)*(1-x)^2).
a(n) = Lucas(n+2) + Fibonacci(n+1) - (n+3).
a(n) = 3*a(n-1) - 2*a(n-2) - a(n-3) + a(n-4); a(0)=1, a(1)=1, a(2)=4, a(3)=8. - Harvey P. Dale, Nov 06 2011
a(n) = -3 + (2^(-n)*((1-sqrt(5))^n*(-3+2*sqrt(5)) + (1+sqrt(5))^n*(3+2*sqrt(5)))) / sqrt(5) - n. - Colin Barker, Mar 11 2017
MATHEMATICA
RecurrenceTable[{a[0]==a[1]==1, a[n]==a[n-1]+a[n-2]+n}, a, {n, 40}] (* or *) LinearRecurrence[{3, -2, -1, 1}, {1, 1, 4, 8}, 40] (* Harvey P. Dale, Nov 06 2011 *)
PROG
(Magma) [Lucas(n+2) + Fibonacci(n+1) - (n+3) : n in [0..40]]; // Vincenzo Librandi, Nov 16 2011
(PARI) Vec((1-2*x+3*x^2-x^3)/((1-x-x^2)*(1-x)^2) + O(x^40)) \\ Colin Barker, Mar 11 2017
(PARI) vector(40, n, n--; f=fibonacci; f(n+3)+2*f(n+1)-n-3) \\ G. C. Greubel, Jul 24 2019
(Sage) f=fibonacci; [f(n+3)+2*f(n+1)-n-3 for n in (0..40)] # G. C. Greubel, Jul 24 2019
(GAP) F:=Fibonacci;; List([0..40], n-> F(n+3)+2*F(n+1)-n-3); # G. C. Greubel, Jul 24 2019
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
EXTENSIONS
Description corrected and sequence extended by Erich Friedman
STATUS
approved