cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-10 of 18 results. Next

A219987 Number A(n,k) of tilings of a k X n rectangle using dominoes and right trominoes; square array A(n,k), n>=0, k>=0, read by antidiagonals.

Original entry on oeis.org

1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 2, 0, 1, 1, 1, 5, 5, 1, 1, 1, 0, 11, 8, 11, 0, 1, 1, 1, 24, 55, 55, 24, 1, 1, 1, 0, 53, 140, 380, 140, 53, 0, 1, 1, 1, 117, 633, 2319, 2319, 633, 117, 1, 1, 1, 0, 258, 1984, 15171, 21272, 15171, 1984, 258, 0, 1
Offset: 0

Views

Author

Alois P. Heinz, Dec 02 2012

Keywords

Examples

			A(3,3) = 8, because there are 8 tilings of a 3 X 3 rectangle using dominoes and right trominoes:
  .___._.   .___._.   .___._.   .___._.
  |___| |   |___| |   |___| |   |_. | |
  | ._|_|   | | |_|   | |___|   | |_|_|
  |_|___|   |_|___|   |_|___|   |_|___|
  ._.___.   ._.___.   ._.___.   ._.___.
  | |___|   | | ._|   | |___|   | |___|
  |___| |   |_|_| |   |_|_. |   |_| | |
  |___|_|   |___|_|   |___|_|   |___|_|
Square array A(n,k) begins:
  1,  1,   1,    1,     1,       1,         1,          1, ...
  1,  0,   1,    0,     1,       0,         1,          0, ...
  1,  1,   2,    5,    11,      24,        53,        117, ...
  1,  0,   5,    8,    55,     140,       633,       1984, ...
  1,  1,  11,   55,   380,    2319,     15171,      96139, ...
  1,  0,  24,  140,  2319,   21272,    262191,    2746048, ...
  1,  1,  53,  633, 15171,  262191,   5350806,  100578811, ...
  1,  0, 117, 1984, 96139, 2746048, 100578811, 3238675344, ...
		

Crossrefs

Columns (or rows) k=0-10 give: A000012, A059841, A052980, A165716, A165791, A219988, A219989, A219990, A219991, A219992, A219993.
Main diagonal gives: A219994.

Programs

  • Maple
    b:= proc(n, l) option remember; local k, t;
          if max(l[])>n then 0 elif n=0 or l=[] then 1
        elif min(l[])>0 then t:=min(l[]); b(n-t, map(h->h-t, l))
        else for k do if l[k]=0 then break fi od;
             b(n, subsop(k=2, l))+
             `if`(k>1 and l[k-1]=1, b(n, subsop(k=2, k-1=2, l)), 0)+
             `if`(k `if`(n>=k, b(n, [0$k]), b(k, [0$n])):
    seq(seq(A(n, d-n), n=0..d), d=0..14);
  • Mathematica
    b[n_, l_] := b[n, l] = Module[{k, t}, If[Max[l] > n, 0, If[n == 0 || l == {}, 1, If[Min[l] > 0, t = Min[l]; b[n-t, l-t], For[k = 1, True, k++, If[l[[k]] == 0, Break[]]]; b[n, ReplacePart[l, k -> 2]] + If[k > 1 && l[[k-1]] == 1, b[n, ReplacePart[l, {k -> 2, k-1 -> 2}]], 0] + If[k < Length[l] && l[[k+1]] == 1, b[n, ReplacePart[l, {k -> 2, k+1 -> 2}]], 0] + If[k < Length[l] && l[[k+1]] == 0, b[n, ReplacePart[l, {k -> 1, k+1 -> 1}]] + b[n, ReplacePart[l, {k -> 1, k+1 -> 2}]] + b[n, ReplacePart[l, {k -> 2, k+1 -> 1}]], 0] + If[k+1 < Length[l] && l[[k+1]] == 0 && l[[k+2]] == 0, b[n, ReplacePart[l, {k -> 2, k+1 -> 2, k+2 -> 2}]] + b[n, ReplacePart[l, {k -> 2, k+1 -> 2, k+2 -> 1}]], 0]]]]]; a[n_, k_] := If[n >= k, b[n, Array[0&, k]], b[k, Array[0&, n]]]; Table[Table[a[n, d-n], {n, 0, d}], {d, 0, 14}] // Flatten (* Jean-François Alcover, Dec 05 2013, translated from Alois P. Heinz's Maple program *)
  • Sage
    from sage.combinat.tiling import TilingSolver, Polyomino
    def A(n,k):
        p = Polyomino([(0,0), (0,1)])
        q = Polyomino([(0,0), (0,1), (1,0)])
        T = TilingSolver([p,q], box=[n,k], reusable=True, reflection=True)
        return T.number_of_solutions()
    # Ralf Stephan, May 21 2014

A364457 Number A(n,k) of tilings of a k X n rectangle using dominoes and trominoes (of any shape); square array A(n,k), n>=0, k>=0, read by antidiagonals.

Original entry on oeis.org

1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 6, 6, 1, 1, 1, 2, 17, 30, 17, 2, 1, 1, 2, 43, 145, 145, 43, 2, 1, 1, 3, 108, 733, 1352, 733, 108, 3, 1, 1, 4, 280, 3540, 12688, 12688, 3540, 280, 4, 1, 1, 5, 727, 17300, 115958, 226922, 115958, 17300, 727, 5, 1
Offset: 0

Views

Author

Alois P. Heinz, Jul 25 2023

Keywords

Examples

			A(3,2) = A(2,3) = 6:
  .___.   .___.   .___.   .___.   .___.   .___.
  | | |   |___|   | | |   |___|   | ._|   |_. |
  | | |   |___|   |_|_|   | | |   |_| |   | |_|
  |_|_|   |___|   |___|   |_|_|   |___|   |___|  .
.
Square array A(n,k) begins:
  1, 1,   1,     1,       1,        1,          1,            1, ...
  1, 0,   1,     1,       1,        2,          2,            3, ...
  1, 1,   2,     6,      17,       43,        108,          280, ...
  1, 1,   6,    30,     145,      733,       3540,        17300, ...
  1, 1,  17,   145,    1352,    12688,     115958,      1075397, ...
  1, 2,  43,   733,   12688,   226922,    3927233,     68846551, ...
  1, 2, 108,  3540,  115958,  3927233,  128441094,   4263997124, ...
  1, 3, 280, 17300, 1075397, 68846551, 4263997124, 267855152858, ...
		

Crossrefs

Columns (or rows) k=0-10 give: A000012, A182097(n) = A000931(n+3), A019439, A364460, A364155, A364556, A364616, A364617, A364632, A364638, A364640.
Main diagonal gives A364504.

Formula

A(n,k) = A(k,n).

Extensions

Terms n,k>=4 had to be corrected as was pointed out by Martin Fuller and David Radcliffe - Alois P. Heinz, Apr 05 2025

A129682 Number of ways tiling a 2 X n rectangle with 2 X 1 (domino) and 3 X 1 (tromino) tiles.

Original entry on oeis.org

1, 1, 2, 4, 7, 15, 30, 60, 123, 249, 506, 1030, 2093, 4257, 8658, 17606, 35807, 72821, 148096, 301188, 612531, 1245717, 2533444, 5152318, 10478383, 21310119, 43338854, 88139182, 179250591, 364545863, 741384936, 1507770834, 3066386677, 6236177973, 12682652180
Offset: 0

Views

Author

Terry Petrard (temper3243(AT)gmail.com), May 04 2008

Keywords

Comments

Computed using a program with backtracking.

Crossrefs

Column k=2 of A219866. - Alois P. Heinz, Nov 30 2012

Programs

  • Mathematica
    LinearRecurrence[{2,0,1,-2,1,-1},{1,2,4,7,15,30},40] (* Harvey P. Dale, Sep 02 2012 *)
  • PARI
    my(a=vector(50)); a[1]=1; a[2]=1;a[3]=2; a[4]=4; a[5]=7; a[6]=15; for(n=7, 50, a[n]=2*a[n-1]+a[n-3]-2*a[n-4]+a[n-5]-a[n-6]); a \\ Robert Gerbicz, May 09 2008

Formula

a(n) = a(n-1) + a(n-2) + a(n-3) + 2*r(n-3), where r(n) = r(n-1) + r(n-2) + a(n-2);
f(n) = f(n-1) + p(n) + q(n), where p(n) is the number of ways after filling 2 X n with a horizontal 2 X 1 domino and q(n) is the number of ways after filling 2 X n with a horizontal 3 X 1 domino.
r(n) is a 2 X n rectangle with 1 square removed from top left
p(n) is a 2 X n rectangle with 2 square removed from top left
q(n) is a 2 X n rectangle with 3 square removed from top left
p(n) = f(n-2) + r(n-2) (tiling with 2x1 gives f(n-2) and 3x1 gives r(n-2))
q(n) = f(n-3) + r(n-2) (tiling with 3x1 gives f(n-3) and 2x1 gives r(n-2))
r(n) = r(n-1) + p(n-2) (tiling with 2x1 gives r(n-1), tiling with a 3x1 gives p(n-2))
a(n)=2*a(n-1)+a(n-3)-2*a(n-4)+a(n-5)-a(n-6) - Robert Gerbicz, May 09 2008
G.f.: (1 - x - x^3)/((1-x)*(1-x-x^2-2*x^3-x^5)). - R. J. Mathar, Oct 30 2008

Extensions

More terms from Robert Gerbicz, May 09 2008

A219867 Number of tilings of a 3 X n rectangle using dominoes and straight (3 X 1) trominoes.

Original entry on oeis.org

1, 1, 4, 14, 41, 143, 472, 1562, 5233, 17395, 58002, 193346, 644219, 2147421, 7156704, 23852324, 79497767, 264952955, 883057354, 2943113598, 9809007073, 32692164351, 108958689984, 363145140266, 1210315480391, 4033823637937, 13444208923518, 44807796457932
Offset: 0

Views

Author

Alois P. Heinz, Nov 30 2012

Keywords

Examples

			a(2) = 4, because there are 4 tilings of a 3 X 2 rectangle using dominoes and straight (3 X 1) trominoes:
.___.   .___.   .___.   .___.
| | |   |___|   | | |   |___|
| | |   |___|   |_|_|   | | |
|_|_|   |___|   |___|   |_|_|
		

Crossrefs

Column k=3 of A219866.

Programs

  • Maple
    gf:= -(x^15 +x^13 +x^12 +6*x^11 -x^10 +3*x^9 -10*x^8 -4*x^7 -9*x^6 +2*x^5 +2*x^4 +7*x^3 +2*x^2 -1) / (x^18 +x^17 +4*x^16 +5*x^15 +10*x^14 -3*x^13 +3*x^12 -24*x^11 -14*x^10 -24*x^9 +13*x^8 +5*x^7 +30*x^6 +11*x^5 +3*x^4 -12*x^3 -5*x^2 -x +1):
    a:= n-> coeff(series(gf, x, n+1), x, n):
    seq(a(n), n=0..30);

Formula

G.f.: see Maple program.

A219874 Number of tilings of an n X n square using dominoes and straight (3 X 1) trominoes.

Original entry on oeis.org

1, 0, 2, 14, 184, 9612, 1143834, 354859954, 295743829064, 631206895803116, 3541054185616706122, 51821077154605344550820, 1976225122734369352127065686, 196913655491597719598898811003348, 51179690353659852099434654264900753288, 34716223657627061096793572212632925410608268
Offset: 0

Views

Author

Alois P. Heinz, Nov 30 2012

Keywords

Examples

			a(3) = 14, because there are 14 tilings of a 3 X 3 square using dominoes and straight (3 X 1) trominoes:
  ._____. ._____. ._____. ._____. .___._. .___._. .___._.
  | | | | | | | | | |___| | |___| | | | | |___| | |___| |
  | | | | | |_|_| | |___| | | | | |_|_| | |___| | | | | |
  |_|_|_| |_|___| |_|___| |_|_|_| |___|_| |___|_| |_|_|_|
  ._____. ._____. ._____. ._____. ._____. ._____. ._____.
  |_____| |_____| |_____| |_____| | |___| | | | | |___| |
  |_____| | |___| | | | | |___| | |_|___| |_|_|_| |___|_|
  |_____| |_|___| |_|_|_| |___|_| |_____| |_____| |_____|  .
		

Crossrefs

Main diagonal of A219866.

Extensions

a(12) from Alois P. Heinz, Sep 30 2014
a(13)-a(15) (using Liang Kai's terms in A219866) from Alois P. Heinz, Mar 12 2025

A233313 Number of tilings of a 2 X 3 X n box using bricks of shape 3 X 1 X 1 and 2 X 1 X 1.

Original entry on oeis.org

1, 4, 45, 717, 9787, 148414, 2282036, 34688229, 530613082, 8119995275, 124183342755, 1899899589557, 29066650643742, 444678773140018, 6803102237763707, 104079849391557116, 1592303310404361651, 24360457647669398381, 372687643806340329749, 5701702230014416236396
Offset: 0

Views

Author

Alois P. Heinz, Dec 07 2013

Keywords

Examples

			a(1) = A219866(3,2) = A129682(3) = A219866(2,3) = A219867(2) = 4:
._____.  ._____.  ._____.  ._____.
|_____|  | | | |  |___| |  | |___|
|_____|  |_|_|_|  |___|_|  |_|___|.
		

Crossrefs

Programs

  • Maple
    s:= subsop:
    b:= proc(n, l) option remember; local k, t; t:= min(l[]);
          if n=0 then 1 elif t>0 then b(n-t, map(h->h-t, l))
        else for k while l[k]>0 do od; add(`if`(n>=j,
             b(n, s(k=j, l)), 0), j=2..3)+ `if`(k<=4 and l[k+2]=0,
             b(n, s(k=1, k+2=1, l))+ `if`(k<=2 and l[k+4]=0,
             b(n, s(k=1, k+2=1, k+4=1, l)), 0), 0)+ `if`(
             irem(k, 2)>0 and l[k+1]=0, b(n, s(k=1, k+1=1, l)), 0)
          fi
        end:
    a:=n-> b(n, [0$6]):
    seq(a(n), n=0..25);
  • Mathematica
    b[n_, l_] := b[n, l] = Module[{k, t}, t = Min[l]; If [n == 0, 1, If[t > 0, b[n-t, l-t], k = 1; While[l[[k]] > 0 , k++]; Sum[If[n >= j, b[n, ReplacePart[l, k -> j]], 0], {j, 2, 3}] + If[k <= 4 && l[[k+2]] == 0, b[n, ReplacePart[l, {k -> 1, k+2 -> 1}]] + If[k <= 2 && l[[k+4]] == 0, b[n, ReplacePart[l, {k -> 1, k+2 -> 1, k+4 -> 1}]], 0], 0] + If[Mod[k, 2] > 0 && l[[k+1]] == 0, b[n, ReplacePart[l, {k -> 1, k+1 -> 1}]], 0] ] ] ]; a[n_] := b[n, Array[0&, 6]]; Table[a[n], {n, 0, 25}] (* Jean-François Alcover, Dec 16 2013, translated from Maple *)

A233505 Number of tilings of a 2 X 2 X n box using bricks of shape 3 X 1 X 1 and 2 X 1 X 1.

Original entry on oeis.org

1, 2, 9, 45, 201, 1062, 5564, 28859, 152012, 799387, 4202165, 22117465, 116385352, 612443308, 3223118545, 16961953022, 89264218645, 469766599585, 2472212575433, 13010374123502, 68468999197712, 360328057238019, 1896278913278432, 9979444454056631
Offset: 0

Views

Author

Alois P. Heinz, Dec 11 2013

Keywords

Crossrefs

Programs

  • Maple
    a:= n-> coeff(series((x^17 +3*x^16 -x^15 -5*x^14 +8*x^13 -8*x^12 -22*x^10 -20*x^9 -62*x^8 -20*x^7 -42*x^6 +18*x^5 +19*x^3 +x^2 +3*x -1)/(-x^20 -2*x^19 +2*x^18 +9*x^17 -12*x^16 +27*x^15 +41*x^14 +66*x^13 +62*x^12 +184*x^11 +76*x^10 +156*x^9 -92*x^8 +20*x^7 -141*x^6 +28*x^5 -62*x^4 +19*x^3 +5*x -1), x, n+1), x, n):
    seq(a(n), n=0..40);

Formula

G.f.: (x^17 +3*x^16 -x^15 -5*x^14 +8*x^13 -8*x^12 -22*x^10 -20*x^9 -62*x^8 -20*x^7 -42*x^6 +18*x^5 +19*x^3 +x^2 +3*x -1) / (-x^20 -2*x^19 +2*x^18 +9*x^17 -12*x^16 +27*x^15 +41*x^14 +66*x^13 +62*x^12 +184*x^11 +76*x^10 +156*x^9 -92*x^8 +20*x^7 -141*x^6 +28*x^5 -62*x^4 +19*x^3 +5*x -1).

A233506 Number of tilings of a 3 X 3 X n box using bricks of shape 3 X 1 X 1 and 2 X 1 X 1.

Original entry on oeis.org

1, 14, 717, 62253, 4732061, 382882762, 31449389548, 2571574546111, 210607584419520, 17254476918858789, 1413637025226131703, 115812392270890399373, 9488271882367228634756, 777357166136453697810804, 63686950935296529029018801, 5217741644362129948411085318
Offset: 0

Views

Author

Alois P. Heinz, Dec 11 2013

Keywords

Crossrefs

Programs

  • Maple
    b:= proc(n, l) option remember; local k, t; t:= min(l[]);
          if n=0 then 1 elif t>0 then b(n-t, map(h->h-t, l))
        else for k while l[k]>0 do od;
             add(`if`(n>=j, b(n, s(k=j, l)), 0), j=2..3)+
             `if`(k<=6 and l[k+3]=0, b(n, s(k=1, k+3=1, l)), 0)+
             `if`(k<=3 and l[k+3]=0 and l[k+6]=0,
                b(n, s(k=1, k+3=1, k+6=1, l)), 0)+
             `if`(irem(k, 3)>0 and l[k+1]=0,
                b(n, s(k=1, k+1=1, l)), 0)+
             `if`(irem(k, 3)=1 and l[k+1]=0 and l[k+2]=0,
                b(n, subsop(k=1, k+1=1, k+2=1, l)), 0)
          fi
        end:
    a:=n-> b(n, [0$9]): s:=subsop:
    seq(a(n), n=0..10);
  • Mathematica
    b[n_, l_] := b[n, l] = Module[{k, t}, t := Min[l]; If [n == 0, 1, If[t > 0, b[n-t, l-t], k = 1; While[l[[k]] > 0, k++ ]; Sum[If[n >= j, b[n, ReplacePart[l, k -> j]], 0], {j, 2, 3}] + If[k <= 6 && l[[k+3]] == 0, b[n, ReplacePart[l, {k -> 1, k+3 -> 1}]], 0] + If[k <= 3 && l[[k+3]] == 0 && l[[k+6]] == 0, b[n, ReplacePart[l, {k -> 1, k+3 -> 1, k+6 -> 1}]], 0] + If[Mod[k, 3] > 0 && l[[k+1]] == 0, b[n, ReplacePart[l, {k -> 1, k+1 -> 1}]], 0] + If[Mod[k, 3] == 1 && l[[k+1]] == 0 && l[[k+2]] == 0, b[n, ReplacePart[l, {k -> 1, k+1 -> 1, k+2 -> 1}]], 0] ]] ]; a[n_] := b[n, Array[0&, 9]]; Table[a[n], {n, 0, 10}] // Flatten (* Jean-François Alcover, Dec 16 2013, translated from Maple *)

A233507 Number of tilings of a 2 X 4 X n box using bricks of shape 3 X 1 X 1 and 2 X 1 X 1.

Original entry on oeis.org

1, 7, 201, 9787, 379688, 16512483, 726964790, 31549810845, 1378740599284, 60239603421159, 2630166605483293, 114886450998314920, 5017916294582867990, 219163121582772423673, 9572435654283943792842, 418094220600909382190818, 18261053013117932038592765
Offset: 0

Views

Author

Alois P. Heinz, Dec 11 2013

Keywords

Examples

			a(1) = A219866(4,2) = A129682(4) = A219866(2,4) = A219862(2) = 7:
._______. ._______. ._______. ._______.
|_____| | | |_____| | | | | | |___| | |
|_____|_| |_|_____| |_|_|_|_| |___|_|_|
._______. ._______. ._______.
| |___| | | | |___| |___|___|
|_|___|_| |_|_|___| |___|___|.
		

Crossrefs

Programs

  • Maple
    b:= proc(n, l) option remember; local k, t; t:= min(l[]);
          if n=0 then 1
        elif t>0 then b(n-t, map(h->h-t, l))
        else for k while l[k]>0 do od;
             add(`if`(n>=j, b(n, s(k=j, l)), 0), j=2..3)+
             `if`(k<=6 and l[k+2]=0, b(n, s(k=1, k+2=1, l)), 0)+
             `if`(k<=4 and l[k+2]=0 and l[k+2*2]=0, b(n, s(k=1,
             k+2=1, k+2*2=1, l)), 0)+ `if`(irem(k, 2)>0 and
             l[k+1]=0, b(n, s(k=1, k+1=1, l)), 0)
          fi
        end:
    a:=n-> b(n, [0$8]): s:= subsop:
    seq(a(n), n=0..10);
  • Mathematica
    b[n_, l_] := b[n, l] = Module[{k, t}, t = Min[l]; Which[n == 0, 1, t > 0, b[n-t, l-t], True, For[k = 1, l[[k]] > 0, k++]; Sum[If[n >= j, b[n, ReplacePart[l, k -> j]], 0], {j, 2, 3}] + If[k <= 6 && l[[k + 2]] == 0, b[n, ReplacePart[l, {k -> 1, k+2 -> 1}]], 0] + If[k <= 4 && l[[k+2]] == 0 && l[[k+2*2]] == 0, b[n, ReplacePart[l, {k -> 1, k+2 -> 1, k+2*2 -> 1}]], 0] + If[Mod[k, 2] > 0 && l[[k+1]] == 0, b[n, ReplacePart[l, {k -> 1, k+1 -> 1}]], 0]]]; a[n_] := b[n, Array[0&, 8]]; Table[Print[an = a[n]]; an, {n, 0, 16}] (* Jean-François Alcover, Dec 30 2013, translated from Maple *)

A233509 Number of tilings of a 2 X 5 X n box using bricks of shape 3 X 1 X 1 and 2 X 1 X 1.

Original entry on oeis.org

1, 15, 1062, 148414, 16512483, 2043497465, 257251613508, 31941208907916, 3990164870713039, 498504394558488109, 62237975023439983192, 7773270324407375580946, 970802515607358269506951, 121240108673115249961266051, 15141593230837339625055971170
Offset: 0

Views

Author

Alois P. Heinz, Dec 11 2013

Keywords

Examples

			a(1) = A219866(5,2) = A129682(5) = A219866(2,5) = A219868(2) = 15:
.___.  .___.  .___.  .___.  .___.  .___.  .___.  .___.
| | |  |___|  | | |  |___|  | | |  |___|  | | |  |___|
| | |  |___|  |_|_|  | | |  | | |  |___|  |_|_|  | | |
|_|_|  |___|  |___|  |_|_|  |_|_|  |___|  |___|  |_|_|
| | |  | | |  | | |  | | |  |___|  |___|  |___|  |___|
|_|_|  |_|_|  |_|_|  |_|_|  |___|  |___|  |___|  |___|
.___.  .___.  .___.  .___.  .___.  .___.  .___.
| | |  | | |  |___|  |___|  | | |  | | |  |___|
|_|_|  |_|_|  |___|  |___|  |_| |  | |_|  | | |
| | |  | | |  | | |  | | |  | |_|  |_| |  | | |
| | |  |_|_|  | | |  |_|_|  | | |  | | |  |_|_|
|_|_|  |___|  |_|_|  |___|  |_|_|  |_|_|  |___|.
		

Crossrefs

Programs

  • Maple
    b:= proc(n, l) option remember; local k, t; t:= min(l[]);
          if n=0 then 1 elif t>0 then b(n-t, map(h->h-t, l))
        else for k while l[k]>0 do od;
             add(`if`(n>=j, b(n, s(k=j, l)), 0), j=2..3)+
             `if`(k<=5 and l[k+5]=0, b(n, s(k=1, k+5=1, l)), 0)+
             `if`(irem(k, 5)>0 and l[k+1]=0, b(n, s(k=1, k+1=1, l)), 0)+
             `if`(irem(k, 5) in [$1..3] and l[k+1]=0 and l[k+2]=0,
             b(n, s(k=1, k+1=1, k+2=1, l)), 0)
          fi
        end:
    a:=n-> b(n, [0$10]): s:=subsop:
    seq(a(n), n=0..4);
  • Mathematica
    b[n_, l_] := b[n, l] = Module[{k, t}, t = Min[l]; Which[n == 0, 1, t > 0, b[n-t, l-t], True, For[k = 1, l[[k]] > 0, k++]; Sum[If[n >= j, b[n, ReplacePart[l, k -> j]], 0], {j, 2, 3}] + If[k <= 5 && l[[k+5]] == 0, b[n, ReplacePart[l, {k -> 1, k+5 -> 1}]], 0] + If[Mod[k, 5] > 0 && l[[k+1]] == 0, b[n, ReplacePart[l, {k -> 1, k+1 -> 1}]], 0] + If[1 <= Mod[k, 5] <= 3 && l[[k+1]] == 0 && l[[k+2]] == 0, b[n, ReplacePart[l, {k -> 1, k+1 -> 1, k+2 -> 1}]], 0]]];a[n_] := b[n, Array[0&, 10]]; Table[Print[an = a[n]]; an, {n, 0, 14}] (* Jean-François Alcover, Dec 30 2013, translated from Maple *)
Showing 1-10 of 18 results. Next