%I #7 Jun 13 2015 00:51:52
%S 0,2,2,4,4,9,16,31,56,109,209,403,773,1491,2873,5538,10671,20570,
%T 39649,76426,147312,283954,547338,1055028,2033628,3919945,7555936,
%U 14564535,28074040,54114453,104308961,201061987,387559437,747044835,1439975217
%N a(n)=the sum of the (1,2)- and (1,3)-entries and twice the (1,4)-entry of the matrix P^n + T^n, where the 4 X 4 matrices P and T are defined by P=[0,1,0,0;0,0,1,0;0,0,0,1;1,0,0,0] and T=[0,1,0,0;0,0,1,0;0,0,0,1;1,1,1,1].
%H <a href="/index/Rec">Index entries for linear recurrences with constant coefficients</a>, signature (1,1,1,2,-1,-1,-1,-1).
%e a(7)=31 because P^7=[0,0,0,1;1,0,0,0;0,1,0,0;0,0,1,0], T^7=[4,6,7,8;8,12,14,15;15,23,27,29;29,44,52,56] and so P^7+T^7=[4,6,7,9;9,12,14,15;15,24,27,29;29,44,53,56]; so a(7)=6+7+2*9=31.
%p with(linalg): a:=proc(n) local P,T,k: P[1]:=matrix(4,4,[0,1,0,0,0,0,1,0,0,0,0,1,1,0,0,0]): T[1]:=matrix(4,4,[0,1,0,0,0,0,1,0,0,0,0,1,1,1,1,1]):for k from 2 to n do P[k]:=multiply(P[1],P[k-1]): T[k]:=multiply(T[1],T[k-1]) od: evalm(P[n]+T[n])[1,2]+evalm(P[n]+T[n])[1,3]+2*evalm(P[n]+T[n])[1,4] end: 0,seq(a(n),n=1..40);
%t [0] = {0, 1, 1, 2}; w[0] = {0, 1, 1, 2}; M4 = {{0, 1, 0, 0}, {0, 0, 1, 0}, {0, 0, 0, 1}, {1, 0, 0, 0}}; Mt = {{0, 1, 0, 0}, {0, 0, 1, 0}, {0, 0, 0, 1}, {1, 1, 1, 1}}; v[n_] := v[n] = M4.v[n - 1] w[n_] := w[n] = Mt.w[n - 1] a = Table[(w[n] + v[n])[[1]], {n, 0, 50}]
%K nonn,easy
%O 0,2
%A _Roger L. Bagula_, Jun 17 2005