%I #49 Dec 31 2023 10:17:19
%S 0,3,9,36,135,513,1944,7371,27945,105948,401679,1522881,5773680,
%T 21889683,82990089,314639316,1192888215,4522582593,17146412424,
%U 65006985051,246460192425,934401532428,3542585174559,13430960120961
%N a(n) = 3*a(n-1) + 3*a(n-2), a(0)=0, a(1)=3.
%C The first entry of the vector v[n] = M*v[n-1], where M is the 2 x 2 matrix [[0,3],[1,3]] and v[1] is the column vector [0,1]. The characteristic polynomial of the matrix M is x^2-3x-3.
%H Reinhard Zumkeller, <a href="/A106435/b106435.txt">Table of n, a(n) for n = 0..1000</a>
%H Martin Burtscher, Igor Szczyrba, and Rafał Szczyrba, <a href="https://www.emis.de/journals/JIS/VOL18/Szczyrba/sz3.html">Analytic Representations of the n-anacci Constants and Generalizations Thereof</a>, Journal of Integer Sequences, Vol. 18 (2015), Article 15.4.5.
%H Tanya Khovanova, <a href="http://www.tanyakhovanova.com/RecursiveSequences/RecursiveSequences.html">Recursive Sequences</a>
%H <a href="/index/Rec#order_02">Index entries for linear recurrences with constant coefficients</a>, signature (3,3).
%F G.f.: 3*x/(1-3*x-3*x^2). - _Philippe Deléham_, Nov 19 2008
%F From _G. C. Greubel_, Mar 12 2020: (Start)
%F a(n) = 3^((n+1)/2) * Fibonacci(n, sqrt(3)), where F(n, x) is the Fibonacci polynomial.
%F a(n) = 3^((n+1)/2)*i^(1-n)*ChebyshevU(n-1, i*sqrt(3)/2). (End)
%p seq(coeff(series(3*x/(1-3*x-3*x^2), x, n+1), x, n), n = 0..30); # _G. C. Greubel_, Mar 12 2020
%t LinearRecurrence[{3,3}, {0,3}, 30] (* _G. C. Greubel_, Mar 12 2020 *)
%o (PARI) a(n)=([0,3;1,3]^n)[1,2]
%o (Haskell)
%o a106435 n = a106435_list !! n
%o a106435_list = 0 : 3 : map (* 3) (zipWith (+) a106435_list (tail
%o a106435_list))
%o -- _Reinhard Zumkeller_, Oct 15 2011
%o (Magma) a:=[0,3]; [n le 2 select a[n] else 3*Self(n-1) + 3*Self(n-2) : n in [1..24]]; // _Marius A. Burtea_, Jan 21 2020
%o (Magma) R<x>:=PowerSeriesRing(Rationals(), 25); Coefficients(R!(3*x/(1-3*x-3*x^2))); // _Marius A. Burtea_, Jan 21 2020
%o (Sage) [3^((n+1)/2)*i^(1-n)*chebyshev_U(n-1, i*sqrt(3)/2) for n in (0..30)] # _G. C. Greubel_, Mar 12 2020
%Y Equals 3*A030195(n).
%Y Cf. A028860.
%Y Cf. A002605, A026150, A028859, A080040, A083337, A108898, A125145.
%K nonn,easy
%O 0,2
%A _Roger L. Bagula_, May 29 2005
%E Edited by _N. J. A. Sloane_, May 20 2006 and May 29 2006
%E Offset corrected by _Reinhard Zumkeller_, Oct 15 2011