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-3 of 3 results.

A321316 Number T(n,k) of permutations of [n] whose difference between the length of the longest increasing subsequence and the length of the longest decreasing subsequence equals k; triangle T(n,k), n >= 1, 1-n <= k <= n-1, read by rows.

Original entry on oeis.org

1, 1, 0, 1, 1, 0, 4, 0, 1, 1, 0, 9, 4, 9, 0, 1, 1, 0, 16, 25, 36, 25, 16, 0, 1, 1, 0, 25, 81, 125, 256, 125, 81, 25, 0, 1, 1, 0, 36, 196, 421, 1225, 1282, 1225, 421, 196, 36, 0, 1, 1, 0, 49, 400, 1225, 4292, 9261, 9864, 9261, 4292, 1225, 400, 49, 0, 1
Offset: 1

Views

Author

Alois P. Heinz, Nov 03 2018

Keywords

Examples

			:                                1                             ;
:                          1,    0,    1                       ;
:                    1,    0,    4,    0,   1                  ;
:               1,   0,    9,    4,    9,   0,   1             ;
:          1,   0,  16,   25,   36,   25,  16,   0,  1         ;
:      1,  0,  25,  81,  125,  256,  125,  81,  25,  0, 1      ;
:   1, 0, 36, 196, 421, 1225, 1282, 1225, 421, 196, 36, 0, 1   ;
		

Crossrefs

Column k=0 gives A321313.
Row sums give A000142.
T(n+1,n-2) gives A000290.

Programs

  • Maple
    h:= l-> (n-> add(i, i=l)!/mul(mul(1+l[i]-j+add(`if`(j>
        l[k], 0, 1), k=i+1..n), j=1..l[i]), i=1..n))(nops(l)):
    f:= l-> h(l)^2*x^(l[1]-nops(l)) :
    g:= (n, i, l)-> `if`(n=0 or i=1, f([l[], 1$n]),
         g(n, i-1, l) +g(n-i, min(i, n-i), [l[], i])):
    b:= proc(n) option remember; g(n$2, []) end:
    T:= (n, k)-> coeff(b(n), x, k):
    seq(seq(T(n, k), k=1-n..n-1), n=1..10);
  • Mathematica
    h[l_] := With[{n = Length[l]}, Total[l]!/Product[Product[1 + l[[i]] - j + Sum[If[j > l[[k]], 0, 1], {k, i + 1, n}], {j, 1, l[[i]]}], {i, 1, n}]];
    f[l_] := h[l]^2*x^(l[[1]] - Length[l]);
    g[n_, i_, l_] := If[n == 0 || i == 1, f[Join[l, Table[1, {n}]]], g[n, i - 1, l] + g[n - i, Min[i, n - i], Append[l, i]]];
    b[n_] := b[n] = g[n, n, {}];
    T[n_, k_] := Coefficient[b[n], x, k];
    Table[Table[T[n, k], {k, 1 - n, n - 1}], {n, 1, 10}] // Flatten (* Jean-François Alcover, Feb 27 2021, after Alois P. Heinz *)

Formula

T(n,k) = T(n,-k).
Sum_{k=1..n-1} T(n,k) = A321314(n).
Sum_{k=0..n-1} T(n,k) = A321315(n).
(1/2) * Sum_{k=1-n..n-1} abs(k) * T(n,k) = A321277(n).
(1/2) * Sum_{k=1-n..n-1} k^2 * T(n,k) = A321278(n).

A321314 Number of permutations of [n] where the length of the longest increasing subsequence is larger than the length of the longest decreasing subsequence.

Original entry on oeis.org

0, 1, 1, 10, 42, 232, 1879, 15228, 131452, 1329136, 15106976, 182954700, 2363478435, 33096395494, 501248446126, 8094778608472, 138112754890488, 2487454752219208, 47344572399516136, 950682668010605104, 20055050996527350752, 442701537970743308588, 10202898078512473893032
Offset: 1

Views

Author

Alois P. Heinz, Nov 03 2018

Keywords

Crossrefs

Programs

  • Maple
    h:= l-> (n-> add(i, i=l)!/mul(mul(1+l[i]-j+add(`if`(j>
        l[k], 0, 1), k=i+1..n), j=1..l[i]), i=1..n))(nops(l)):
    f:= l-> `if`(l[1] `if`(n=0 or i=1, f([l[], 1$n]),
         g(n, i-1, l) +g(n-i, min(i, n-i), [l[], i])):
    a:= n-> g(n$2, []):
    seq(a(n), n=1..23);
  • Mathematica
    h[l_] := With[{n = Length[l]}, Total[l]!/Product[Product[1 + l[[i]] - j + Sum[If[j > l[[k]], 0, 1], {k, i + 1, n}], {j, 1, l[[i]]}], {i, 1, n}]];
    f[l_] := If[l[[1]] < Length[l], h[l]^2, 0];
    g[n_, i_, l_] := If[n == 0 || i == 1, f[Join[l, Table[1, {n}]]], g[n, i - 1, l] + g[n - i, Min[i, n - i], Append[l, i]]];
    a[n_] := g[n, n, {}];
    Array[a, 25] (* Jean-François Alcover, Aug 31 2021, after Alois P. Heinz *)

Formula

a(n) = Sum_{k=1..n-1} A321316(n,k).
a(n) = (n! - A321313(n))/2.
a(n) = A321315(n) - A321313(n).

A321315 Number of permutations of [n] where the length of the longest increasing subsequence is larger than or equal to the length of the longest decreasing subsequence.

Original entry on oeis.org

1, 1, 5, 14, 78, 488, 3161, 25092, 231428, 2299664, 24809824, 296046900, 3863542365, 54081895706, 806425921874, 12828011279528, 217574673205512, 3914918953508792, 74300528009315864, 1482219340166034896, 31035891175182089248, 681299189806864371412, 15649118660372502746968
Offset: 1

Views

Author

Alois P. Heinz, Nov 03 2018

Keywords

Crossrefs

Programs

  • Maple
    h:= l-> (n-> add(i, i=l)!/mul(mul(1+l[i]-j+add(`if`(j>
        l[k], 0, 1), k=i+1..n), j=1..l[i]), i=1..n))(nops(l)):
    f:= l-> `if`(l[1]>=nops(l), h(l)^2, 0):
    g:= (n, i, l)-> `if`(n=0 or i=1, f([l[], 1$n]),
         g(n, i-1, l) +g(n-i, min(i, n-i), [l[], i])):
    a:= n-> g(n$2, []):
    seq(a(n), n=1..23);

Formula

a(n) = Sum_{k=0..n-1} A321316(n,k).
a(n) = A321313(n) + A321314(n).
Showing 1-3 of 3 results.