%I #63 Jun 16 2024 11:09:46
%S 3,-1,-1,5,-5,-1,11,-15,3,23,-41,21,43,-105,83,65,-253,271,47,-571,
%T 795,-177,-1189,2161,-1149,-2201,5511,-4459,-3253,13223,-14429,-2047,
%U 29699,-42081,10335,61445,-113861,62751,112555,-289167,239363,162359,-690889,767893,85355
%N a(n) = -a(n-1) - a(n-2) + a(n-3), a(0)=3, a(1)=-1, a(2)=-1.
%C Previous name was: Sum of the determinants of the principal minors of 2nd order of n-th power of Tribomatrix: first row (1, 1, 0); second row (1, 0, 1); third row (1, 0, 0).
%C a(n) is related to the generalized Lucas numbers S(n). For instance, 2S(n) = a(n)^2 - a(2n).
%C a(n) is also the reflected (A074058) sequence of the generalized tribonacci sequence (A001644).
%H Vincenzo Librandi, <a href="/A073145/b073145.txt">Table of n, a(n) for n = 0..1000</a>
%H Mario Catalani, <a href="http://arxiv.org/abs/math/0210201">Polymatrix and Generalized Polynacci Numbers</a>, arXiv:math/0210201 [math.CO], 2002.
%H Curtis Cooper, S. Miller, Peter J. C. Moses, M. Sahin, and T. Thanatipanonda, <a href="http://thotsaporn.com/Cooper.pdf">On Identities of Ruggles, Horadam, Howard, and Young</a>, Preprint 2016.
%H Kai Wang, <a href="https://www.researchgate.net/publication/344295426_IDENTITIES_FOR_GENERALIZED_ENNEANACCI_NUMBERS">Identities for generalized enneanacci numbers</a>, Generalized Fibonacci Sequences (2020).
%H <a href="/index/Rec#order_03">Index entries for linear recurrences with constant coefficients</a>, signature (-1,-1,1).
%F a(n) = -a(n-1) - a(n-2) + a(n-3), a(0)=3, a(1)=-1, a(2)=-1.
%F O.g.f.: (3 + 2*x + x^2)/(1 + x + x^2 - x^3).
%F a(n) = -T(n)^2 + 2*T(n-1)^2 + 3*T(n-2)^2 - 2*T(n)*T(n-1) + 2*T(n)*T(n-2) + 4*T(n-1)*T(n-2), where T(n) are tribonacci numbers (A000073).
%F a(n) = 3*A057597(n+2) + 2*A057597(n+1) + A057597(n). - _R. J. Mathar_, Jun 06 2011
%F From _Peter Bala_, Jun 29 2015: (Start)
%F a(n) = alpha^n + beta^n + gamma^n, where alpha, beta and gamma are the roots of 1 - x - x^2 - x^3 = 0.
%F x^2*exp( Sum_{n >= 1} a(n)*x^n/n ) = x^2 - x^3 + 2*x*5 - 3*x^6 + x^7 + ... is the o.g.f. for A057597. (End)
%F a(n) = A001644(-n) for all n in Z. - _Michael Somos_, Dec 17 2016
%e G.f. = 3 - x - x^2 + 5*x^3 - 5*x^4 - x^5 + 11*x^6 - 15*x^7 + 3*x^8 + 23*x^9 + ...
%t A = Table[0, {3}, {3}]; A[[1, 1]] = 1; A[[1, 2]] = 1; A[[2, 1]] = 1; A[[2, 3]] = 1; A[[3, 1]] = 1; For[i = 1; t = IdentityMatrix[3], i < 50, i++, t = t.A; Print[t[[2, 2]]*t[[3, 3]] - t[[2, 3]]*t[[3, 2]] + t[[1, 1]]*t[[3, 3]] - t[[1, 3]]*t[[3, 1]] + t[[1, 1]]*t[[2, 2]] - t[[1, 2]]*t[[2, 1]]]]
%t LinearRecurrence[{-1, -1, 1}, {3, -1, -1}, 50] (* _Vincenzo Librandi_, Aug 17 2013 *)
%t nxt[{a_,b_,c_}]:={b,c,a-b-c}; NestList[nxt,{3,-1,-1},50][[;;,1]] (* _Harvey P. Dale_, Jun 16 2024 *)
%o (Magma) I:=[3,-1,-1]; [n le 3 select I[n] else -Self(n-1)-Self(n-2)+Self(n-3): n in [1..50]]; // _Vincenzo Librandi_, Aug 17 2013
%o (PARI) {a(n) = if( n<0, polsym(1 + x+ x^2 - x^3, -n)[-n+1], polsym(1 - x - x^2 - x^3, n)[n+1])}; /* _Michael Somos_, Dec 17 2016 */
%o (PARI) a(n)=([0,1,0; 0,0,1; 1,-1,-1]^n*[3;-1;-1])[1,1] \\ _Charles R Greathouse IV_, Feb 07 2017
%o (Sage) ((3+2*x+x^2)/(1+x+x^2-x^3)).series(x, 50).coefficients(x, sparse=False) # _G. C. Greubel_, Apr 22 2019
%Y Cf. A000073, A001644, A057597.
%K easy,sign
%O 0,1
%A Mario Catalani (mario.catalani(AT)unito.it), Jul 17 2002
%E Better name by _Joerg Arndt_, Aug 17 2013
%E More terms from _Vincenzo Librandi_, Aug 17 2013
%E Deleted certain dangerous or potentially dangerous links. - _N. J. A. Sloane_, Jan 30 2021