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.

A214268 Number A(n,k) of compositions of n where the difference between largest and smallest parts is <= k and adjacent parts are unequal; square array A(n,k), n>=0, k>=0, read by antidiagonals.

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 3, 2, 1, 1, 1, 1, 3, 4, 4, 1, 1, 1, 1, 3, 4, 5, 3, 1, 1, 1, 1, 3, 4, 7, 11, 5, 1, 1, 1, 1, 3, 4, 7, 12, 12, 3, 1, 1, 1, 1, 3, 4, 7, 14, 20, 16, 5, 1, 1, 1, 1, 3, 4, 7, 14, 21, 28, 30, 5, 1
Offset: 0

Views

Author

Alois P. Heinz, Jul 09 2012

Keywords

Examples

			A(3,0) = 1: [3].
A(4,1) = 2: [4], [1,2,1].
A(5,2) = 5: [5], [3,2], [2,3], [2,1,2], [1,3,1].
A(6,3) = 12: [6], [4,2], [3,2,1], [3,1,2], [2,4], [2,3,1], [2,1,3], [2,1,2,1], [1,4,1], [1,3,2], [1,2,3], [1,2,1,2].
A(7,4) = 21: [7], [5,2], [4,3], [4,2,1], [4,1,2], [3,4], [3,1,3], [3,1,2,1], [2,5], [2,4,1], [2,3,2], [2,1,4], [2,1,3,1], [1,5,1], [1,4,2], [1,3,2,1], [1,3,1,2], [1,2,4], [1,2,3,1], [1,2,1,3], [1,2,1,2,1].
Square array A(n,k) begins:
  1,  1,  1,  1,  1,  1,  1,  1, ...
  1,  1,  1,  1,  1,  1,  1,  1, ...
  1,  1,  1,  1,  1,  1,  1,  1, ...
  1,  3,  3,  3,  3,  3,  3,  3, ...
  1,  2,  4,  4,  4,  4,  4,  4, ...
  1,  4,  5,  7,  7,  7,  7,  7, ...
  1,  3, 11, 12, 14, 14, 14, 14, ...
  1,  5, 12, 20, 21, 23, 23, 23, ...
		

Crossrefs

Columns k=0, 1 give: A000012, 1+A214270(n).
Main diagonal gives: A003242.

Programs

  • Maple
    b:= proc(n, k, s, t, l) option remember;
          `if`(n<0, 0, `if`(n=0, 1, add(`if`(j=l, 0, b(n-j, k,
           min(s, j), max(t, j), j)), j=max(1, t-k+1)..s+k-1)))
        end:
    A:= (n, k)-> `if`(n=0, 1, add(b(n-j, k+1, j, j, j), j=1..n)):
    seq(seq(A(n,d-n), n=0..d), d=0..14);
  • Mathematica
    b[n_, k_, s_, t_, l_] := b[n, k, s, t, l] = If[n < 0, 0, If[n == 0, 1, Sum[If[j == l, 0, b[n - j, k, Min[s, j], Max[t, j], j]], {j, Max[1, t - k + 1], s + k - 1}]]]; A[n_, k_] := If[n == 0, 1, Sum[b[n - j, k + 1, j, j, j], {j, 1, n}]]; Table[Table[A [n, d - n], {n, 0, d}], {d, 0, 14}] // Flatten (* Jean-François Alcover, Dec 27 2013, translated from Maple *)