OFFSET
0,2
COMMENTS
In general, the ordinary generating function for the recurrence relation b(n) = b(n - 1) + 2*b(n - 2) + 3*b(n - 3) + 4*b(n - 4) + ... + k*b(n - k), with n > k - 1 and initial values b(i-1) = i for i = 1..k, is (Sum_{m = 0..(k - 1)} (-m^3 - 3*m^2 + 4*m + 6)*x^m/6)/(1 - Sum_{m = 1..k} m*x^m).
LINKS
Index entries for linear recurrences with constant coefficients, signature (1,2,3,4).
FORMULA
G.f.: (1 + x - x^2 - 6*x^3)/(1 - x - 2*x^2 - 3*x^3 - 4*x^4).
MATHEMATICA
LinearRecurrence[{1, 2, 3, 4}, {1, 2, 3, 4}, 30]
CoefficientList[Series[(1 + x - x^2 - 6 x^3) / (1 - x - 2 x^2 - 3 x^3 - 4 x^4), {x, 0, 33}], x] (* Vincenzo Librandi, Feb 04 2016 *)
PROG
(PARI) Vec((1+x-x^2-6*x^3)/(1-x-2*x^2-3*x^3-4*x^4) + O(x^40)) \\ Michel Marcus, Feb 02 2016
(Magma) [n le 4 select n else Self(n-1)+2*Self(n-2)+3*Self(n-3)+4*Self(n-4): n in [1..35]]; // Vincenzo Librandi, Feb 04 2016
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Ilya Gutkovskiy, Feb 02 2016
STATUS
approved