OFFSET
0,3
COMMENTS
The recursive multipliers "one two three" are found in the three right coefficients of the characteristic polynomial of M: x^3 - x^2 - 2x - 3, (with changed signs). Lim_{n -> oo} a(n)/a(n-1) tends to 2.3744237632...an eigenvalue of M and a root of the characteristic polynomial.
LINKS
G. C. Greubel, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (1,2,3).
FORMULA
a(n) = a(n-1) + 2*a(n-2) + 3*a(n-3), a(0) = a(1) = 1, a(2) = 3.
a(n) = left term in M^n * [1, 0, 0], where M = the 3X3 matrix([1, 1, 1], [2, 0, 0], [0, 3/2, 0]).
EXAMPLE
a(8) = 561 = 235 + 2*100 + 3*42 = a(7) + 2*a(6) + 3*a(5).
a(5) = 42, since M^5 * [1, 0, 0] = [42, 34, 24].
MATHEMATICA
a[0]=a[1]=1; a[2]=3; a[n_]:= a[n]= a[n-1] + 2a[n-2] + 3a[n-3];
Table[ a[n], {n, 0, 29}] (* Or *)
a[n_]:= (MatrixPower[{{1, 1, 1}, {2, 0, 0}, {0, 3/2, 0}}, n].{{1}, {0}, {0}})[[1, 1]];
Table[ a[n], {n, 0, 29}] (* Robert G. Wilson v, Dec 20 2004 *)
LinearRecurrence[{1, 2, 3}, {1, 1, 3}, 30] (* Harvey P. Dale, Feb 06 2019 *)
PROG
(PARI) Vec(1/(1-x-2*x^2-3*x^3)+O(x^99)) \\ Charles R Greathouse IV, Sep 26 2012
(Magma) I:=[1, 1, 3]; [n le 3 select I[n] else Self(n-1) +2*Self(n-2) +3*Self(n-3): n in [1..41]]; // G. C. Greubel, Mar 27 2023
(SageMath)
@CachedFunction
def a(n): # a = A101822
if (n<3): return (1, 1, 3)[n]
else: return a(n-1) + 2*a(n-2) + 3*a(n-3)
[a(n) for n in range(41)] # G. C. Greubel, Mar 27 2023
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Gary W. Adamson, Dec 17 2004
EXTENSIONS
More terms from Robert G. Wilson v, Dec 20 2004
STATUS
approved