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 14 results. Next

A287215 Number T(n,k) of set partitions of [n] such that the maximal absolute difference between the least elements of consecutive blocks equals k; triangle T(n,k), n>=0, 0<=k<=max(n-1,0), read by rows.

Original entry on oeis.org

1, 1, 1, 1, 1, 3, 1, 1, 8, 5, 1, 1, 22, 21, 7, 1, 1, 65, 86, 39, 11, 1, 1, 209, 361, 209, 77, 19, 1, 1, 732, 1584, 1123, 493, 171, 35, 1, 1, 2780, 7315, 6153, 3124, 1293, 413, 67, 1, 1, 11377, 35635, 34723, 20019, 9320, 3709, 1059, 131, 1, 1, 49863, 183080, 202852, 130916, 66992, 30396, 11373, 2837, 259, 1
Offset: 0

Views

Author

Alois P. Heinz, May 21 2017

Keywords

Comments

The maximal absolute difference is assumed to be zero if there are fewer than two blocks.
T(n,k) is defined for all n,k >= 0. The triangle contains only the positive terms. T(n,k) = 0 if k>=n and k>0.

Examples

			T(4,0) = 1: 1234.
T(4,1) = 8: 134|2, 13|24, 14|23, 1|234, 14|2|3, 1|24|3, 1|2|34, 1|2|3|4.
T(4,2) = 5: 124|3, 12|34, 12|3|4, 13|2|4, 1|23|4.
T(4,3) = 1: 123|4.
Triangle T(n,k) begins:
  1;
  1;
  1,   1;
  1,   3,    1;
  1,   8,    5,    1;
  1,  22,   21,    7,   1;
  1,  65,   86,   39,  11,   1;
  1, 209,  361,  209,  77,  19,  1;
  1, 732, 1584, 1123, 493, 171, 35, 1;
		

Crossrefs

Row sums give A000110.
T(2n,n) gives A322884.

Programs

  • Maple
    b:= proc(n, k, m, l) option remember; `if`(n<1, 1,
         `if`(l-n>k, 0, b(n-1, k, m+1, n))+m*b(n-1, k, m, l))
        end:
    A:= (n, k)-> b(n-1, min(k, n-1), 1, n):
    T:= (n, k)-> A(n, k)-`if`(k=0, 0, A(n, k-1)):
    seq(seq(T(n, k), k=0..max(n-1, 0)), n=0..12);
  • Mathematica
    b[n_, k_, m_, l_] := b[n, k, m, l] = If[n < 1, 1, If[l - n > k, 0, b[n - 1, k, m + 1, n]] + m*b[n - 1, k, m, l]];
    A[n_, k_] := b[n - 1, Min[k, n - 1], 1, n];
    T[n_, k_] := A[n, k] - If[k == 0, 0, A[n, k - 1]];
    Table[T[n, k], {n, 0, 12}, {k, 0, Max[n - 1, 0]}] // Flatten (* Jean-François Alcover, May 19 2018, after Alois P. Heinz *)

Formula

T(n,k) = A287216(n,k) - A287216(n,k-1) for k>0, T(n,0) = 1.

A287214 Number A(n,k) of set partitions of [n] such that for each block all absolute differences between consecutive elements are <= k; 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, 2, 1, 1, 1, 2, 4, 1, 1, 1, 2, 5, 8, 1, 1, 1, 2, 5, 13, 16, 1, 1, 1, 2, 5, 15, 34, 32, 1, 1, 1, 2, 5, 15, 47, 89, 64, 1, 1, 1, 2, 5, 15, 52, 150, 233, 128, 1, 1, 1, 2, 5, 15, 52, 188, 481, 610, 256, 1, 1, 1, 2, 5, 15, 52, 203, 696, 1545, 1597, 512, 1
Offset: 0

Views

Author

Alois P. Heinz, May 21 2017

Keywords

Comments

The sequence of column k satisfies a linear recurrence with constant coefficients of order 2^(k-1) for k>0.

Examples

			A(4,0) = 1: 1|2|3|4.
A(4,1) = 8: 1234, 123|4, 12|34, 12|3|4, 1|234, 1|23|4, 1|2|34, 1|2|3|4.
A(4,2) = 13: 1234, 123|4, 124|3, 12|34, 12|3|4, 134|2, 13|24, 13|2|4, 1|234, 1|23|4, 1|24|3, 1|2|34, 1|2|3|4.
Square array A(n,k) begins:
  1,  1,   1,   1,   1,   1,   1,   1, ...
  1,  1,   1,   1,   1,   1,   1,   1, ...
  1,  2,   2,   2,   2,   2,   2,   2, ...
  1,  4,   5,   5,   5,   5,   5,   5, ...
  1,  8,  13,  15,  15,  15,  15,  15, ...
  1, 16,  34,  47,  52,  52,  52,  52, ...
  1, 32,  89, 150, 188, 203, 203, 203, ...
  1, 64, 233, 481, 696, 825, 877, 877, ...
		

Crossrefs

Main diagonal gives A000110.

Programs

  • Maple
    b:= proc(n, k, l) option remember; `if`(n=0, 1, b(n-1, k, map(x->
          `if`(x-n>=k, [][], x), [l[], n]))+add(b(n-1, k, sort(map(x->
          `if`(x-n>=k, [][], x), subsop(j=n, l)))), j=1..nops(l)))
        end:
    A:= (n, k)-> b(n, min(k, n-1), []):
    seq(seq(A(n, d-n), n=0..d), d=0..12);
  • Mathematica
    b[0, , ] = 1; b[n_, k_, l_List] := b[n, k, l] = b[n - 1, k, If[# - n >= k, Nothing, #]& /@ Append[l, n]] + Sum[b[n - 1, k, Sort[If[# - n >= k, Nothing, #]& /@ ReplacePart[l, j -> n]]], {j, 1, Length[l]}];
    A[n_, k_] := b[n, Min[k, n - 1], {}];
    Table[A[n, d - n], {d, 0, 12}, {n, 0, d}] // Flatten (* Jean-François Alcover, Apr 30 2018, after Alois P. Heinz *)

Formula

A(n,k) = Sum_{j=0..k} A287213(n,j).

A258109 Number of balanced parenthesis expressions of length 2n and depth 3.

Original entry on oeis.org

1, 5, 18, 57, 169, 482, 1341, 3669, 9922, 26609, 70929, 188226, 497845, 1313501, 3459042, 9096393, 23895673, 62721698, 164531565, 431397285, 1130708866, 2962826465, 7761964833, 20331456642, 53249182309, 139449644717, 365166860706, 956185155129, 2503657040137
Offset: 3

Views

Author

Gheorghe Coserea, May 20 2015

Keywords

Comments

a(n) is the number of Dyck paths of length 2n and height 3. For example, a(3) = 1 because there is only one such Dyck path which is UUUDDD. - Ran Pan, Sep 26 2015
a(n) is the number of rooted plane trees with n+1 nodes and height 3 (see example for correspondence). - Gheorghe Coserea, Feb 04 2016

Examples

			For n=4, the a(4) = 5 solutions are
                /\       /\
               /  \        \
LRLLLRRR    /\/    \        \
................................
                /\        |
             /\/  \      / \
LLRLLRRR    /      \        \
................................
              /\/\        |
             /    \       |
LLLRLRRR    /      \     / \
................................
              /\          |
             /  \/\      / \
LLLRRLRR    /      \    /
................................
              /\          /\
             /  \        /
LLLRRRLR    /    \/\    /
		

References

  • S. S. Skiena and M. A. Revilla, Programming Challenges: The Programming Contest Training Manual, Springer, 2006, page 140.

Crossrefs

Column k=3 of A080936.
Column k=2 of A287213.

Programs

  • C
    typedef long long unsigned Integer;
    Integer a(int n)
    {
        int i;
        Integer pow2 = 1, a[3] = {0};
        for (i = 3; i <= n; ++i) {
            a[ i%3 ] = pow2 + 3 * a[ (i-1)%3 ] - a[ (i-2)%3 ];
            pow2 = pow2 * 2;
        }
        return a[ (i-1)%3 ];
    }
    
  • Magma
    I:=[1,5,18,57,169]; [n le 5 select I[n] else 5*Self(n-1) - 7*Self(n-2) + 2*Self(n-3): n in [1..40]]; // Vincenzo Librandi, Sep 26 2015
    
  • Maple
    a:= proc(n) option remember; `if`(n<3, 0,
          `if`(n=3, 1, 2^(n-3) +3*a(n-1) -a(n-2)))
        end:
    seq(a(n), n=3..30);  # Alois P. Heinz, May 20 2015
  • Mathematica
    Join[{1, 5}, LinearRecurrence[{5, -7, 2}, {18, 57, 169}, 30]] (* Vincenzo Librandi, Sep 26 2015 *)
  • PARI
    Vec(-x^3/((2*x-1)*(x^2-3*x+1)) + O(x^100)) \\ Colin Barker, May 24 2015
    
  • PARI
    a(n) = fibonacci(2*n-1) - 2^(n-1)  \\ Gheorghe Coserea, Feb 04 2016

Formula

a(n) = 2^(n-3) + 3 * a(n-1) - a(n-2).
a(n) = 5*a(n-1) - 7*a(n-2) + 2*a(n-3) for n>5. - Colin Barker, May 24 2015
G.f.: -x^3 / ((2*x-1)*(x^2-3*x+1)). - Colin Barker, May 24 2015
a(n) = A000045(2n-1) - A000079(n-1). - Gheorghe Coserea, Feb 04 2016
a(n) = 2^(-1-n)*(-5*4^n - (-5+sqrt(5))*(3+sqrt(5))^n + (3-sqrt(5))^n*(5+sqrt(5))) / 5. - Colin Barker, Jun 05 2017
a(n) = Sum_{i=1..n-1} A061667(i)*(n-1-i) - Tim C. Flowers, May 16 2018

A287416 Number T(n,k) of set partitions of [n] such that the maximal value of all absolute differences between least elements of consecutive blocks and between consecutive elements within the blocks equals k; triangle T(n,k), n>=0, 0<=k<=max(n-1,0), read by rows.

Original entry on oeis.org

1, 1, 0, 2, 0, 3, 2, 0, 4, 8, 3, 0, 5, 22, 19, 6, 0, 6, 52, 81, 48, 16, 0, 7, 114, 289, 267, 147, 53, 0, 8, 240, 941, 1250, 968, 529, 204, 0, 9, 494, 2894, 5310, 5469, 3919, 2174, 878, 0, 10, 1004, 8601, 21256, 28083, 25326, 17593, 9961, 4141
Offset: 0

Views

Author

Alois P. Heinz, May 24 2017

Keywords

Comments

The maximal value is assumed to be zero if there are no consecutive blocks and no consecutive elements.
T(n,k) is defined for all n,k >= 0. The triangle contains only the terms for k <= max(n-1,0). T(n,k) = 0 if k>=n and k>0.

Examples

			T(4,1) = 4: 1234, 1|234, 1|2|34, 1|2|3|4.
T(4,2) = 8: 124|3, 12|34, 12|3|4, 134|2, 13|24, 13|2|4, 1|23|4, 1|24|3.
T(4,3) = 3: 123|4, 14|23, 14|2|3.
T(5,3) = 19: 1235|4, 123|45, 123|4|5, 125|34, 125|3|4, 134|25, 134|2|5, 13|24|5, 13|25|4, 145|23, 14|235, 14|23|5, 1|234|5, 145|2|3, 14|25|3, 14|2|35, 14|2|3|5, 1|25|34, 1|25|3|4.
Triangle T(n,k) begins:
  1;
  1;
  0, 2;
  0, 3,   2;
  0, 4,   8,   3;
  0, 5,  22,  19,    6;
  0, 6,  52,  81,   48,  16;
  0, 7, 114, 289,  267, 147,  53;
  0, 8, 240, 941, 1250, 968, 529, 204;
  ...
		

Crossrefs

Columns k=1-2 give: A001477 (for n>1), A005803 (for n>0).
Row sums give A000110.

Programs

  • Maple
    b:= proc(n, k, l, t) option remember; `if`(n<1, 1, `if`(t-n>k, 0,
           b(n-1, k, map(x-> `if`(x-n>=k, [][], x), [l[], n]), n)) +add(
           b(n-1, k, sort(map(x-> `if`(x-n>=k, [][], x), subsop(j=n, l))),
           `if`(t-n>k, infinity, t)), j=1..nops(l)))
        end:
    A:= (n, k)-> b(n, min(k, n-1), [], n):
    T:= (n, k)-> A(n, k)-`if`(k=0, 0, A(n, k-1)):
    seq(seq(T(n, k), k=0..max(n-1, 0)), n=0..12);
  • Mathematica
    b[n_, k_, l_, t_] := b[n, k, l, t] = If[n < 1, 1, If[t - n > k, 0, b[n - 1, k, If[# - n >= k, Nothing, #]& /@ Append[l, n], n]] + Sum[b[n - 1, k, Sort[If[# - n >= k, Nothing, #]& /@ ReplacePart[l, j -> n]], If[t - n > k, Infinity, t]], {j, 1, Length[l]}]];
    A[n_, k_] := b[n, Min[k, n - 1], {}, n];
    T[n_, k_] := A[n, k] - If[k == 0, 0, A[n, k - 1]];
    Table[T[n, k], {n, 0, 12}, { k, 0, Max[n - 1, 0]}] // Flatten (* Jean-François Alcover, May 24 2018, translated from Maple *)

Formula

T(n,k) = A287417(n,k) - A287417(n,k-1) for k>0, T(n,0) = 1.
T(n+2,n+1) = 1 + A000110(n).

A287640 Number T(n,k) of set partitions of [n], where k is minimal such that for all j in [n]: j is member of block b implies b = 1 or at least one of j-1, ..., j-k is member of a block >= b-1; triangle T(n,k), n >= 0, 0 <= k <= max(floor(n/2), n-2), read by rows.

Original entry on oeis.org

1, 1, 1, 1, 1, 4, 1, 13, 1, 1, 41, 9, 1, 1, 131, 59, 11, 1, 1, 428, 344, 88, 15, 1, 1, 1429, 1906, 634, 146, 23, 1, 1, 4861, 10345, 4389, 1231, 280, 39, 1, 1, 16795, 55901, 30006, 9835, 2763, 602, 71, 1, 1, 58785, 303661, 205420, 77178, 25014, 6967, 1408, 135, 1
Offset: 0

Views

Author

Alois P. Heinz, May 28 2017

Keywords

Examples

			T(4,0) = 1: 1234.
T(4,1) = 13: 123|4, 124|3, 12|34, 12|3|4, 134|2, 13|24, 14|23, 1|234, 1|23|4, 14|2|3, 1|24|3, 1|2|34, 1|2|3|4.
T(4,2) = 1: 13|2|4.
T(5,2) = 9: 124|3|5, 135|2|4, 13|25|4, 13|2|45, 13|2|4|5, 14|23|5, 14|2|35, 14|2|3|5, 1|24|3|5.
T(6,3) = 11: 1245|3|6, 1346|2|5, 134|26|5, 134|2|56, 134|2|5|6, 145|23|6, 145|2|36, 145|2|3|6, 14|25|3|6, 15|24|3|6, 1|245|3|6.
T(6,4) = 1: 1345|2|6.
T(7,4) = 15: 12456|3|7, 13457|2|6, 1345|27|6, 1345|2|67, 1345|2|6|7, 1456|23|7, 1456|2|37, 1456|2|3|7, 145|26|3|7, 146|25|3|7, 14|256|3|7, 156|24|3|7, 15|246|3|7, 16|245|3|7, 1|2456|3|7.
Triangle T(n,k) begins:
  1;
  1;
  1,    1;
  1,    4;
  1,   13,     1;
  1,   41,     9,    1;
  1,  131,    59,   11,    1;
  1,  428,   344,   88,   15,   1;
  1, 1429,  1906,  634,  146,  23,  1;
  1, 4861, 10345, 4389, 1231, 280, 39, 1;
  ...
		

Crossrefs

Columns k=0-1 give: A000012, A001453.
Row sums give A000110.

Programs

  • Maple
    b:= proc(n, l) option remember; `if`(n=0 or l=[], 1, add(b(n-1,
          [seq(max(l[i], j), i=2..nops(l)), j]), j=1..l[1]+1))
        end:
    T:= (n, k)-> `if`(k=0, 1, b(n, [0$k])-b(n, [0$k-1])):
    seq(seq(T(n, k), k=0..max(n/2, n-2)), n=0..12);
  • Mathematica
    b[n_, l_] := b[n, l] = If[n == 0 || l == {}, 1, Sum[b[n-1, Append[Table[ Max[l[[i]], j], {i, 2, Length[l]}], j]], {j, 1, l[[1]] + 1}]];
    T[n_, k_] := If[k == 0, 1, b[n, Table[0, k]] - b[n, Table[0, k - 1]]];
    Table[T[n, k], {n, 0, 12}, { k, 0, Max[n/2, n - 2]}] // Flatten (* Jean-François Alcover, May 22 2018, translated from Maple *)

Formula

T(n,k) = A287641(n,k) - A287641(n,k-1) for k>0, T(n,0) = 1.
T(n+4,n+1) = A168415(n) for n>0.

A294052 Number of set partitions of [n] such that the maximal absolute difference between consecutive elements within a block equals three.

Original entry on oeis.org

2, 13, 61, 248, 935, 3368, 11777, 40347, 136214, 454922, 1507000, 4961100, 16253188, 53045703, 172607505, 560317916, 1815445901, 5873136282, 18976870985, 61256217631, 197573796328, 636837047532, 2051636248268, 6606758265032, 21268025275930, 68445465415825
Offset: 4

Views

Author

Alois P. Heinz, Oct 22 2017

Keywords

Crossrefs

Column k=3 of A287213.

Programs

  • Mathematica
    LinearRecurrence[{7,-15,8,5,-5,1},{2,13,61,248,935,3368},30] (* Harvey P. Dale, Nov 22 2023 *)

Formula

G.f.: (x-2)*x^4/((x-1)*(x^2-3*x+1)*(x^3-x^2-3*x+1)).
a(n) = A287275(n) - A001519(n).

A294053 Number of set partitions of [n] such that the maximal absolute difference between consecutive elements within a block equals four.

Original entry on oeis.org

5, 38, 215, 1061, 4835, 20973, 88010, 360787, 1453978, 5784863, 22790024, 89092968, 346161413, 1338360327, 5153828402, 19781784669, 75723483993, 289218958150, 1102597884045, 4196961350447, 15954736073286, 60585891849501, 229855881578197, 871373727460242
Offset: 5

Views

Author

Alois P. Heinz, Oct 22 2017

Keywords

Crossrefs

Column k=4 of A287213.

Programs

  • Mathematica
    Drop[CoefficientList[Series[(x^5-2x^4+x^3-3x^2+7x-5)x^5/((x-1)(x^3-x^2- 3x+1)(x^8-x^7-7x^5+7x^4+x^3+4x^2-5x+1)),{x,0,30}],x],5] (* or *) LinearRecurrence[{9,-26,23,0,20,-40,2,16,-1,0,-3,1},{5,38,215,1061,4835,20973,88010,360787,1453978,5784863,22790024,89092968},30] (* Harvey P. Dale, May 25 2022 *)

Formula

G.f.: (x^5-2*x^4+x^3-3*x^2+7*x-5)*x^5 / ((x-1) *(x^3-x^2-3*x+1) *(x^8 -x^7 -7*x^5 +7*x^4 +x^3 +4*x^2 -5*x+1)).
a(n) = A287276(n) - A287275(n).

A294054 Number of set partitions of [n] such that the maximal absolute difference between consecutive elements within a block equals five.

Original entry on oeis.org

15, 129, 836, 4789, 25430, 128360, 625905, 2976800, 13896153, 63950894, 291050996, 1312981604, 5881158250, 26191105884, 116085151862, 512487018089, 2255036961813, 9895020092839, 43316960894877, 189247864529166, 825397574526671, 3594688070523059, 15635607417594050
Offset: 6

Views

Author

Alois P. Heinz, Oct 22 2017

Keywords

Crossrefs

Column k=5 of A287213.

Formula

G.f.: (x^15-3*x^13-2*x^12-4*x^11+7*x^10+21*x^9+9*x^8-33*x^7-44*x^6+48*x^5-10*x^4 +18*x^3+17*x^2-36*x+15)*x^6 / ((x^8-x^7-7*x^5+7*x^4+x^3+4*x^2-5*x+1) *(x^10-x^9 -x^7 -9*x^6 +10*x^5+9*x^4-7*x^3+4*x^2-5*x+1)*(x^6+x^5-x^4-3*x^2-x+1)).
a(n) = A287277(n) - A287276(n).

A294055 Number of set partitions of [n] such that the maximal absolute difference between consecutive elements within a block equals six.

Original entry on oeis.org

52, 495, 3573, 22986, 138140, 791355, 4378359, 23619010, 124985133, 651528571, 3356054226, 17122003113, 86672668175, 435922323548, 2180749707230, 10860449611842, 53881317215173, 266455227999826, 1314042578677412, 6464913802646613, 31741357154688581, 155566738708385012
Offset: 7

Views

Author

Alois P. Heinz, Oct 22 2017

Keywords

Crossrefs

Column k=6 of A287213.

Formula

a(n) = A287278(n) - A287277(n).

A294056 Number of set partitions of [n] such that the maximal absolute difference between consecutive elements within a block equals seven.

Original entry on oeis.org

203, 2108, 16657, 117897, 783922, 4993579, 30785899, 185088952, 1091673665, 6342173645, 36398304558, 206815079839, 1165446105293, 6522388312404, 36291251200978, 200938029161451, 1107900649341124, 6086624218751214, 33335270870796943, 182080367445331011, 992214076623396046
Offset: 8

Views

Author

Alois P. Heinz, Oct 22 2017

Keywords

Crossrefs

Column k=7 of A287213.

Formula

a(n) = A287279(n) - A287278(n).
Showing 1-10 of 14 results. Next