OFFSET
0,2
COMMENTS
LINKS
Daniel Suteu, Table of n, a(n) for n = 0..999
Index entries for linear recurrences with constant coefficients, signature (3,-2,-1,1).
FORMULA
a(n) = 3*a(n-1) - 2*a(n-2) - a(n-3) + a(n-4).
G.f.: (1 - x + 2*x^2 - x^3)/((1-x-x^2)*(1-x)^2). - R. J. Mathar, May 11 2014
a(0) = 1; a(1) = 2; a(n) = 1 + n + a(n-1) + a(n-2). - Daniel Suteu, Jan 12 2016
a(n) = 2*Fibonacci(n+2) + 3*Fibonacci(n+1) - n - 4. - G. C. Greubel, Jul 11 2019
MAPLE
F:= gfun:-rectoproc({a(0) = 1, a(1) = 2, a(n) = 1 + n + a(n-1) + a(n-2)}, a(n), remember):
map(F, [$0..100]); # Robert Israel, Jan 18 2016
MATHEMATICA
(* First progream *)
q = x^2; s = x + 1; z = 40;
p[0, x] := 1;
p[n_, x_] := x*p[n - 1, x] + n (n + 3)/2;
Table[Expand[p[n, x]], {n, 0, 7}]
reduce[{p1_, q_, s_, x_}] :=
FixedPoint[(s PolynomialQuotient @@ #1 +PolynomialRemainder @@ #1 &)[{#1, q, x}] &, p1]
t = Table[reduce[{p[n, x], q, s, x}], {n, 0, z}];
u1 = Table[Coefficient[Part[t, n], x, 0], {n, 1, z}] (* A192969 *)
u2 = Table[Coefficient[Part[t, n], x, 1], {n, 1, z}] (* A192970 *)
(* Second program *)
Table[2*Fibonacci[n+2]+3*Fibonacci[n+1]-n-4, {n, 0, 40}] (* G. C. Greubel, Jul 11 2019 *)
PROG
(Sidef)
func a((0)) { 1 }
func a((1)) { 2 }
func a(n) is cached { 1 + n + a(n-1) + a(n-2) }
100.times { |i| say a(i-1) }
# Daniel Suteu, Jan 12 2016
(PARI) vector(40, n, n--; f=fibonacci; 2*f(n+2)+3*f(n+1)-n-4) \\ G. C. Greubel, Jul 11 2019
(Magma) F:=Fibonacci; [2*F(n+2)+3*F(n+1)-n-4: n in [0..40]]; // G. C. Greubel, Jul 11 2019
(Sage) f=fibonacci; [2*f(n+2)+3*f(n+1)-n-4 for n in (0..40)] # G. C. Greubel, Jul 11 2019
(GAP) F:=Fibonacci;; List([0..40], n-> 2*F(n+2)+3*F(n+1)-n-4); # G. C. Greubel, Jul 11 2019
CROSSREFS
KEYWORD
nonn
AUTHOR
Clark Kimberling, Jul 13 2011
STATUS
approved