OFFSET
1,3
COMMENTS
Lim_{n -> infinity} a(n+1)/a(n) = 2.1478990357047874.
LINKS
G. C. Greubel, Table of n, a(n) for n = 1..1001
Wikipedia, Hessenberg matrix
Index entries for linear recurrences with constant coefficients, signature (1,2,1).
FORMULA
a(n) = Sum_{k=1..n} (k mod 3) * a(n-k).
If p[i] = modp(i,3) and if A is Hessenberg matrix of order n defined by: A[i,j] = p[j-i+1], (i<=j), A[i,j] = -1, (i= j+1), and A[i,j]=0 otherwise. Then, for n >= 1, a(n+1) = det A. - Milan Janjic, May 02 2010
G.f.: x*(1-x)*(1+x+x^2)/(1-x-2*x^2-x^3). - Colin Barker, Feb 01 2012
MATHEMATICA
a[1]=1; a[n_]:= Sum[Mod[k, 3]*a[n-k], {k, 1, n}]; Table[a[n], {n, 1, 35}]
Join[{1}, LinearRecurrence[{1, 2, 1}, {1, 3, 5}, 35]] (* G. C. Greubel, Apr 06 2019 *)
PROG
(PARI) my(x='x+O('x^35)); Vec(x*(1-x^3)/(1-x-2*x^2-x^3)) \\ G. C. Greubel, Apr 06 2019
(Magma) I:=[1, 3, 5]; [1] cat [n le 3 select I[n] else Self(n-1) +2*Self(n -2)+Self(n-3): n in [1..35]]; // G. C. Greubel, Apr 06 2019
(Sage) a=(x*(1-x^3)/(1-x-2*x^2-x^3)).series(x, 35).coefficients(x, sparse=False); a[1:] # G. C. Greubel, Apr 06 2019
CROSSREFS
KEYWORD
nonn
AUTHOR
Roger L. Bagula and Gary W. Adamson, Sep 08 2008
STATUS
approved