%I #59 Sep 08 2022 08:45:28
%S 1,6,40,268,1796,12036,80660,540548,3622516,24276516,162690580,
%T 1090281028,7306586036,48965540196,328145609300,2199088184708,
%U 14737326074356,98763106151076,661867090908820,4435543424059588,29725069786599476,199204401658077156
%N a(0)=1, a(1)=6, a(n) = 7*a(n-1) - 2*a(n-2).
%C First row sum of the matrix M^n, where M is the 3 X 3 matrix {{2,2,2},{2,3,2},{2,2,3}}.
%H Nathaniel Johnston, <a href="/A122074/b122074.txt">Table of n, a(n) for n = 0..200</a>
%H J.-C. Novelli, J.-Y. Thibon, <a href="http://arxiv.org/abs/1403.5962">Hopf Algebras of m-permutations,(m+1)-ary trees, and m-parking functions</a>, arXiv preprint arXiv:1403.5962 [math.CO], 2014. See Fig. 18.
%H Peter Steinbach, <a href="http://www.jstor.org/stable/2691048">Golden fields: a case for the heptagon</a>, Math. Mag. 70 (1997), no. 1, 22-31.
%H <a href="/index/Rec#order_02">Index entries for linear recurrences with constant coefficients</a>, signature (7,-2).
%F a(n) = 8*a(n-1) - 9*a(n-2) + 2*a(n-3); a(0)=1, a(1)=6, a(2)=40 (follows from the minimal polynomial x^3 - 8x^2 + 9x - 2 of M).
%F a(n) = (1/2 + 5*sqrt(41)/82)*(7/2 + sqrt(41)/2)^n + (1/2 - 5*sqrt(41)/82)*(7/2 - sqrt(41)/2)^n. - _Antonio Alberto Olivares_, Jun 06 2011
%F G.f.: (1-x)/(1-7*x+2*x^2). - _Colin Barker_, Feb 08 2012
%F E.g.f.: (1/41)*exp(7*x/2)*(41*cosh(sqrt(41)*x/2) + 5*sqrt(41)*sinh(sqrt(41)*x/2)). - _Stefano Spezia_, Oct 03 2019
%e a(2)=40 because M^2={{12,14,14},{14,17,16},{14,16,17}} and 12+14+14=40.
%p with(linalg): M[1]:=matrix(3,3,[2,2,2,2,3,2,2,2,3]): for n from 2 to 20 do M[n]:=multiply(M[n-1],M[1]) od: 1,seq(M[n][1,1]+M[n][1,2]+M[n][1,3],n=1..20);
%p # alternative:
%p f:= gfun:-rectoproc({a(n+2)-7*a(n+1)+2*a(n),a(0)=1,a(1)=6},a(n),remember):
%p seq(f(n),n=0..30); # _Robert Israel_, Oct 02 2015
%t M = {{2, 2, 2}, {2, 3, 2}, {2, 2, 3}}; v[1] = {1, 1, 1}; v[n_] := v[n] = M.v[n - 1]; a1 = Table[v[n][[1]], {n, 1, 50}]
%t Transpose[NestList[{Last[#],7*Last[#]-2*First[#]}&,{1,6},25]] [[1]] (* _Harvey P. Dale_, Mar 11 2011 *)
%t f[s_] := Append[s, 7*s[[-1]] - 2*s[[-2]]]; Nest[f, {1, 6}, 18] (* _Robert G. Wilson v_, Mar 12 2011 *)
%t LinearRecurrence[{7,-2},{1,6},25] (* _Harvey P. Dale_, Jan 04 2014 *)
%o (PARI) Vec((1-x)/(1-7*x+2*x^2) + O(x^30)) \\ _Michel Marcus_, Oct 03 2015
%o (Magma) I:=[1,6]; [n le 2 select I[n] else 7*Self(n-1)-2*Self(n-2): n in [1..30]]; // _Vincenzo Librandi_, Oct 03 2015
%o (Sage)
%o def A122074_list(prec):
%o P.<x> = PowerSeriesRing(ZZ, prec)
%o return P((1-x)/(1-7*x+2*x^2)).list()
%o A122074_list(30) # _G. C. Greubel_, Oct 02 2019
%o (GAP) a:=[1,6];; for n in [3..30] do a[n]:=7*a[n-1]-2*a[n-2]; od; a; # _G. C. Greubel_, Oct 02 2019
%K nonn,easy
%O 0,2
%A _Gary W. Adamson_, Oct 16 2006
%E Edited by _N. J. A. Sloane_, Oct 29 2006 and Dec 04 2006