Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #20 Aug 28 2023 15:00:21
%S 1,0,5,6,33,72,261,702,2241,6480,19845,58806,177633,530712,1595781,
%T 4780782,14353281,43040160,129153285,387400806,1162300833,3486725352,
%U 10460471301,31380882462,94143533121,282429005040,847289672325,2541864234006,7625600673633
%N Expansion of (2*x-1)*(x-1)*x / ((3*x-1)*(3*x^2-1)).
%C Limit_{n->infinity} a(n+1)/a(n) = 3.
%D Alain M. Robert, Linear Algebra, Examples and Applications World Scientific, 2005, p. 58.
%H Colin Barker, <a href="/A122008/b122008.txt">Table of n, a(n) for n = 1..1000</a>
%H <a href="/index/Rec#order_03">Index entries for linear recurrences with constant coefficients</a>, signature (3,3,-9).
%F a(n) = 3^(n-2) - (-1)^n*A038754(n)/3. - _R. J. Mathar_, Nov 07 2011
%F From _Colin Barker_, Feb 05 2017: (Start)
%F a(n) = 3^(n-2) - 3^((n-3)/2)/2*(-2 + 2*(-1)^n + sqrt(3) + (-1)^n*sqrt(3)) for n>0.
%F a(n) = 3*a(n-1) + 3*a(n-2) - 9*a(n-3) for n>3.
%F (End)
%p A038754 := proc(n)
%p if type(n,'even') then
%p 3^(n/2);
%p else
%p 2*3^((n-1)/2) ;
%p end if;
%p end proc:
%p A122008 := proc(n)
%p 3^(n-2)-(-1)^n*A038754(n)/3 ;
%p end proc:
%p seq(A122008(n),n=1..10) ; # _R. J. Mathar_, Nov 07 2011
%t M = {{0, 1, 2}, {1, 2, 0}, {2, 0, 1}} v[1] = {1, 0, 0} v[n_] := v[n] = M.v[n - 1] a1 = Table[v[n][[1]], {n, 1, 50}]
%t LinearRecurrence[{3,3,-9},{1,0,5},30] (* _Harvey P. Dale_, Aug 28 2023 *)
%o (PARI) Vec((2*x-1)*(x-1)*x / ((3*x-1)*(3*x^2-1)) + O(x^50)) \\ _Colin Barker_, Feb 05 2017
%K nonn,easy
%O 1,3
%A _Roger L. Bagula_ and _Gary W. Adamson_, Sep 11 2006