%I #12 Sep 08 2022 08:46:12
%S 0,1,2,3,20,94,444,2101,9944,47061,222722,1054060,4988472,23608573,
%T 111730550,528778923,2502512960,11843458282,56050660404,265266821305,
%U 1255408695956,5941380026829,28118330498198,133073546286496,629787345390192,2980548061443481,14105819705015690
%N a(n) = n for n = 0..3; for n>3, a(n) = 4*a(n-1) + 3*a(n-2) + 2*a(n-3) + a(n-4).
%C Weighted sum of the four previous terms.
%H <a href="/index/Rec#order_04">Index entries for linear recurrences with constant coefficients</a>, signature (4,3,2,1).
%F G.f.: (8*x^3 + 2*x^2 -x)/(x^4 + 2*x^3 + 3*x^2 +4*x -1).
%t LinearRecurrence[{4, 3, 2, 1}, {0, 1, 2, 3}, 27] (* or *)
%t RecurrenceTable[{a[n] == 4 a[n - 1] + 3 a[n - 2] + 2 a[n - 3] + a[n - 4], a[0] == 0, a[1] == 1, a[2] == 2, a[3] == 3}, a, {n, 0, 26}] (* or *)
%t a[n_] := 4 a[n - 1] + 3 a[n - 2] + 2 a[n - 3] + a[n - 4]; a[0] = 0; a[1] = 1; a[2] = 2; a[3] = 3; Array[a, 27, 0] (* or *)
%t CoefficientList[ Series[(8 x^3 + 2 x^2 - x)/(x^4 + 2 x^3 + 3 x^2 + 4 x - 1), {x, 0, 26}], x]
%o (PARI) a(n)=([0,1,0,0;0,0,1,0;0,0,0,1;1,2,3,4]^n*[0,1,2,3]~)[1] \\ _Charles R Greathouse IV_, May 19 2015
%o (Magma) [n le 4 select n-1 else 4*Self(n-1)+3*Self(n-2)+2*Self(n-3)+Self(n-4): n in [1..40]]; // _Vincenzo Librandi_, May 20 2015
%Y Cf. Weighted sum of the previous term A000004, previous two terms A000129, previous three terms A100477.
%K nonn,easy
%O 0,3
%A _Robert G. Wilson v_, May 19 2015