OFFSET
0,3
COMMENTS
Weighted sum of the three previous terms.
a(n+1) is the number of ways to tile a strip of length n with 3 colors of squares, 2 colors of dominos, and 1 color of tromino, with the restriction that if the first tile is a square, then it can only use two colors. - Greg Dresden and Bora Bursali, Aug 17 2023
LINKS
G. C. Greubel, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (3,2,1).
FORMULA
From R. J. Mathar, Aug 22 2008: (Start)
O.g.f.: x*(1-x)/(1-3*x-2*x^2-x^3).
a(0)=0, a(1)=1, a(2)=2, a(n)=3*a(n-1)+2*a(n-2)+a(n-3). - Harvey P. Dale, Jun 19 2015
MATHEMATICA
RecurrenceTable[{a[n]== 3a[n-1] +2a[n-2] +a[n-3], a[0]==0, a[1]==1, a[2]==2}, a, {n, 0, 26}] (* or *)
CoefficientList[ Series[(x^2-x)/(x^3+2x^2+3x-1), {x, 0, 26}], x] (* Robert G. Wilson v, May 19 2015 *)
LinearRecurrence[{3, 2, 1}, {0, 1, 2}, 40] (* Harvey P. Dale, Jun 19 2015 *)
PROG
(Perl) #!/usr/local/bin/perl -w $d=0; $c=1; $b=2; print "$d, $c, $b, "; $a=0; for (;; ){ $a=3*$b+2*$c+$d; $d=$c; $c=$b; $b=$a; print "$a, "; last if ($a >2**61); } __END__
(Magma) [n le 3 select n-1 else 3*Self(n-1)+2*Self(n-2)+Self(n-3): n in [1..30]]; // Vincenzo Librandi, May 20 2015
(SageMath)
@CachedFunction
def a(n): # a = A100477
if (n<3): return n
else: return 3*a(n-1)+2*a(n-2)+a(n-3)
[a(n) for n in range(41)] # G. C. Greubel, Apr 06 2023
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
gamo (gamo(AT)telecable.es), Nov 22 2004
STATUS
approved