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

A281425 a(n) = [q^n] (1 - q)^n / Product_{j=1..n} (1 - q^j).

Original entry on oeis.org

1, 0, 1, -1, 2, -4, 9, -21, 49, -112, 249, -539, 1143, -2396, 5013, -10550, 22420, -48086, 103703, -223806, 481388, -1029507, 2187944, -4625058, 9742223, -20490753, 43111808, -90840465, 191773014, -405523635, 858378825, -1817304609, 3845492204, -8129023694, 17162802918, -36191083386
Offset: 0

Views

Author

Ilya Gutkovskiy, Oct 05 2017

Keywords

Comments

a(n) is n-th term of the Euler transform of -n + 1, 1, 1, 1, ...
Inverse zero-based binomial transform of A000041. The version for strict partitions is A380412, or A293467 up to sign. - Gus Wiseman, Feb 06 2025

Crossrefs

Programs

  • Maple
    b:= proc(n, k) option remember; `if`(k=0,
          combinat[numbpart](n), b(n, k-1)-b(n-1, k-1))
        end:
    a:= n-> b(n$2):
    seq(a(n), n=0..35);  # Alois P. Heinz, Dec 21 2024
  • Mathematica
    Table[SeriesCoefficient[(1 - q)^n / Product[(1 - q^j), {j, 1, n}], {q, 0, n}], {n, 0, 35}]
    Table[SeriesCoefficient[(1 - q)^n QPochhammer[q^(1 + n), q]/QPochhammer[q, q], {q, 0, n}], {n, 0, 35}]
    Table[SeriesCoefficient[1/QFactorial[n, q], {q, 0, n}], {n, 0, 35}]
    Table[Differences[PartitionsP[Range[0, n]], n], {n, 0, 35}] // Flatten
    Table[Sum[(-1)^j*Binomial[n, j]*PartitionsP[n-j], {j, 0, n}], {n, 0, 30}] (* Vaclav Kotesovec, Oct 06 2017 *)

Formula

a(n) = [q^n] 1/((1 + q)*(1 + q + q^2)*...*(1 + q + ... + q^(n-1))).
a(n) = Sum_{j=0..n} (-1)^j * binomial(n, j) * A000041(n-j). - Vaclav Kotesovec, Oct 06 2017
a(n) ~ (-1)^n * 2^(n - 3/2) * exp(Pi*sqrt(n/12) + Pi^2/96) / (sqrt(3)*n). - Vaclav Kotesovec, May 07 2018

A000140 Kendall-Mann numbers: the most common number of inversions in a permutation on n letters is floor(n*(n-1)/4); a(n) is the number of permutations with this many inversions.

Original entry on oeis.org

1, 1, 2, 6, 22, 101, 573, 3836, 29228, 250749, 2409581, 25598186, 296643390, 3727542188, 50626553988, 738680521142, 11501573822788, 190418421447330, 3344822488498265, 62119523114983224, 1214967840930909302, 24965661442811799655, 538134522243713149122
Offset: 1

Views

Author

Keywords

Comments

Row maxima of A008302, see example.
The term a(0) would be 1: the empty product is one and there is just one coefficient 1=x^0, corresponding to the 1 empty permutation (which has 0 inversions).
From Ryen Lapham and Anant Godbole, Dec 12 2006: (Start)
Also, the number of permutations on {1,2,...,n} for which the number A of monotone increasing subsequences of length 2 and the number D of monotone decreasing 2-subsequences are as close to each other as possible, i.e., 0 or 1. We call such permutations 2-balanced.
If 4|n(n-1) then (with A and D as above) the feasible values of A-D are C(n,2), C(n,2)-2,...,2,0,-2,...,-C(n,2), whereas if 4 does not divide n(n-1), A-D may equal C(n,2), C(n,2)-2,...,1,-1,...,-C(n,2). Let a_n(i) equal the number of permutations with A-D the i-th highest feasible value.
The sequence in question gives the number of permutations for which A-D=0 or A-D=1, i.e., it equals A_n(j) where j = floor((binomial(n,2)+2)/2). Here is the recursion: a_n(i) = a_n(i-1) + a_{n-1}(i) for 1 <= i <= n and a_n(n+k) = a_n(n+k-1) + a_{n-1}(n+k) - a_n(k) for k >= 1. (End)
The only two primes found < 301 are for n = 3 and 6.
Define an ordered list to have n terms with terms t(k) for k=1..n. Specify that t(k) ranges from 1 to k, hence the third term t(3) can be 1, 2, or 3. Find all sums of the terms for all n! allowable arrangements to obtain a maximum sum for the greatest number of arrangements. This number is a(n). For n=4, the maximum sum 7 appears in 6 arrangements: 1114, 1123, 1213, 1222, 1231, and 1132. - J. M. Bergot, May 14 2015
Named after the British statistician Maurice George Kendall (1907-1983) and the Austrian-American mathematician Henry Berthold Mann (1905-2000). - Amiram Eldar, Apr 07 2023

Examples

			From _Joerg Arndt_, Jan 16 2011: (Start)
a(4) = 6 because the among the permutations of 4 elements those with 3 inversions are the most frequent and appear 6 times:
       [inv. table]  [permutation]  number of inversions
   0:    [ 0 0 0 ]    [ 0 1 2 3 ]    0
   1:    [ 1 0 0 ]    [ 1 0 2 3 ]    1
   2:    [ 0 1 0 ]    [ 0 2 1 3 ]    1
   3:    [ 1 1 0 ]    [ 2 0 1 3 ]    2
   4:    [ 0 2 0 ]    [ 1 2 0 3 ]    2
   5:    [ 1 2 0 ]    [ 2 1 0 3 ]    3  (*)
   6:    [ 0 0 1 ]    [ 0 1 3 2 ]    1
   7:    [ 1 0 1 ]    [ 1 0 3 2 ]    2
   8:    [ 0 1 1 ]    [ 0 3 1 2 ]    2
   9:    [ 1 1 1 ]    [ 3 0 1 2 ]    3  (*)
  10:    [ 0 2 1 ]    [ 1 3 0 2 ]    3  (*)
  11:    [ 1 2 1 ]    [ 3 1 0 2 ]    4
  12:    [ 0 0 2 ]    [ 0 2 3 1 ]    2
  13:    [ 1 0 2 ]    [ 2 0 3 1 ]    3  (*)
  14:    [ 0 1 2 ]    [ 0 3 2 1 ]    3  (*)
  15:    [ 1 1 2 ]    [ 3 0 2 1 ]    4
  16:    [ 0 2 2 ]    [ 2 3 0 1 ]    4
  17:    [ 1 2 2 ]    [ 3 2 0 1 ]    5
  18:    [ 0 0 3 ]    [ 1 2 3 0 ]    3  (*)
  19:    [ 1 0 3 ]    [ 2 1 3 0 ]    4
  20:    [ 0 1 3 ]    [ 1 3 2 0 ]    4
  21:    [ 1 1 3 ]    [ 3 1 2 0 ]    5
  22:    [ 0 2 3 ]    [ 2 3 1 0 ]    5
  23:    [ 1 2 3 ]    [ 3 2 1 0 ]    6
The statistics are reflected by the coefficients of the polynomial
(1+x)*(1+x+x^2)*(1+x+x^2+x^3) ==
x^6 + 3*x^5 + 5*x^4 + 6*x^3 + 5*x^2 + 3*x^1 + 1*x^0
There is 1 permutation (the identity) with 0 inversions,
3 permutations with 1 inversion, 5 with 2 inversions,
6 with 3 inversions (the most frequent, marked with (*) ), 5 with 4 inversions, 3 with 5 inversions, and one with 6 inversions. (End)
G.f. = x + x^2 + 2*x^3 + 6*x^4 + 22*x^5 + 101*x^6 + 573*x^7 + 3836*x^8 + ...
		

References

  • F. N. David, M. G. Kendall and D. E. Barton, Symmetric Function and Allied Tables, Cambridge, 1966, p. 241.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Row maxima of A008302.
Odd terms are A186888.

Programs

  • Magma
    /* based on David W. Wilson's formula */ PS:=PowerSeriesRing(Integers()); [ Max(Coefficients(&*[&+[ x^i: i in [0..j] ]: j in [0..n-1] ])): n in [1..21] ]; // Klaus Brockhaus, Jan 18 2011
    
  • Maple
    f := 1: for n from 0 to 40 do f := f*add(x^i, i=0..n): s := series(f, x, n*(n+1)/2+1): m := max(coeff(s, x, j) $ j=0..n*(n+1)/2): printf(`%d,`,m) od: # James Sellers, Dec 07 2000 [offset is off by 1 - N. J. A. Sloane, May 23 2006]
    P:= [1]: a[1]:= 1:
    for n from 2 to 100 do
    P:= expand(P * add(x^j,j=0..n-1));
    a[n]:= max(eval(convert(P,list),x=1));
    od:
    seq(a[i],i=1..100); # Robert Israel, Dec 14 2014
  • Mathematica
    f[n_] := Max@ CoefficientList[ Expand@ Product[ Sum[x^i, {i, 0, j}], {j, n-1}], x]; Array[f, 20]
    Flatten[{1, 1, Table[Coefficient[Expand[Product[Sum[x^k, {k, 0, m-1}], {m, 1, n}]], x^Floor[n*(n-1)/4]], {n, 3, 20}]}] (* Vaclav Kotesovec, May 13 2016 *)
    Table[SeriesCoefficient[QPochhammer[x, x, n]/(1-x)^n, {x, 0, Floor[n*(n-1)/4]}], {n, 1, 20}] (* Vaclav Kotesovec, May 13 2016 *)
  • PARI
    {a(n) = if( n<0, 0, vecmax( Vec( prod(k=1, n, 1 - x^k) / (1 - x)^n)))}; /* Michael Somos, Apr 21 2014 */
    
  • Python
    from math import prod
    from sympy import Poly
    from sympy.abc import x
    def A000140(n): return 1 if n == 1 else max(Poly(prod(sum(x**i for i in range(j+1)) for j in range(n))).all_coeffs()) # Chai Wah Wu, Feb 02 2022

Formula

Largest coefficient of (1)(x+1)(x^2+x+1)...(x^(n-1) + ... + x + 1). - David W. Wilson
The number of terms is given in A000124.
a(n+1)/a(n) = n - 1/2 + O(1/n^{1-epsilon}) as n --> infinity (compare with A008302, A181609, A001147). - Mikhail Gaichenkov, Apr 11 2014
Asymptotics (Mikhail Gaichenkov, 2010): a(n) ~ 6 * n^(n-1) / exp(n). - Vaclav Kotesovec, May 17 2015

Extensions

Edited by N. J. A. Sloane, Mar 05 2011

A128564 Triangle, read by rows, where T(n,k) equals the number of permutations of {1..n+1} with [(nk+k)/2] inversions for n>=k>=0.

Original entry on oeis.org

1, 1, 1, 1, 2, 1, 1, 5, 5, 1, 1, 9, 22, 15, 1, 1, 29, 90, 90, 29, 1, 1, 49, 359, 573, 359, 98, 1, 1, 174, 1415, 3450, 3450, 1415, 174, 1, 1, 285, 5545, 17957, 29228, 21450, 5545, 628, 1, 1, 1068, 21670, 110010, 230131, 230131, 110010, 21670, 1068, 1
Offset: 0

Views

Author

Paul D. Hanna, Mar 12 2007

Keywords

Comments

Row sums equal 2*n! for n>0.

Examples

			Row sums equal 2*n! for n>0:
[1, 2, 4, 12, 48, 240, 1440, 10080, 80640, ..., 2*n!,...].
Triangle begins:
  1;
  1,    1;
  1,    2,     1;
  1,    5,     5,      1;
  1,    9,    22,     15,       1;
  1,   29,    90,     90,      29,       1;
  1,   49,   359,    573,     359,      98,       1;
  1,  174,  1415,   3450,    3450,    1415,     174,      1;
  1,  285,  5545,  17957,   29228,   21450,    5545,    628,     1;
  1, 1068, 21670, 110010,  230131,  230131,  110010,  21670,  1068,    1;
  1, 1717, 84591, 526724, 1729808, 2409581, 1729808, 686763, 84591, 4015, 1;
  ...
		

Crossrefs

Cf. A008302 (Mahonian numbers); A128565 (column 1), A128566 (column 2).
Row sums give A098558.

Programs

  • Maple
    b:= proc(u, o) option remember; expand(`if`(u+o=0, 1,
           add(b(u+j-1, o-j)*x^(u+j-1), j=1..o)+
           add(b(u-j, o+j-1)*x^(u-j), j=1..u)))
        end:
    T:= (n, k)-> coeff(b(n+1, 0), x, iquo((n+1)*k, 2)):
    seq(seq(T(n,k), k=0..n), n=0..10);  # Alois P. Heinz, May 02 2017
  • Mathematica
    b[u_, o_] := b[u, o] = Expand[If[u + o == 0, 1, Sum[b[u + j - 1, o - j]* x^(u+j-1), {j, 1, o}] + Sum[b[u-j, o+j-1]*x^(u-j), {j, 1, u}]]];
    T[n_, k_] := Coefficient[b[n+1, 0], x, Quotient[(n+1)*k, 2]];
    Table[Table[T[n, k], {k, 0, n}], {n, 0, 10}] // Flatten (* Jean-François Alcover, Dec 06 2019, after Alois P. Heinz *)
  • PARI
    {T(n,k)=local(faq=prod(j=1, n+1, (1-q^j)/(1-q))); polcoeff(faq, (n*k+k)\2, q)}

Formula

T(n,k) = A008302(n+1, [(nk+k)/2]) = coefficient of q^[(nk+k)/2] in the q-factorial of n+1 for n>=0.

A214086 Number of involutions of length n having exactly n inversions.

Original entry on oeis.org

1, 0, 0, 1, 1, 2, 10, 17, 39, 119, 254, 613, 1623, 3791, 9281, 23469, 56823, 140035, 349167, 857868, 2122297, 5274213, 13044870, 32357838, 80421284, 199613489, 496144310, 1234420850, 3070773600, 7644879181, 19044266176, 47450853932, 118290412077, 295019269801
Offset: 0

Views

Author

Geoffrey Critzer and Alois P. Heinz, Mar 06 2013

Keywords

Examples

			a(0) = 1: (), the empty involution.
a(3) = 1: (3,2,1); inversions are (3,2), (3,1), (2,1).
a(4) = 1: (3,4,1,2); inversions are (3,1), (3,2), (4,1), (4,2).
a(5) = 2: (1,5,3,4,2), (4,2,3,1,5).
a(6) = 10: (1,2,6,5,4,3), (1,4,6,2,5,3), (1,5,3,6,2,4), (1,5,4,3,2,6), (2,1,6,4,5,3), (3,2,1,6,5,4), (3,5,1,4,2,6), (4,2,3,1,6,5), (4,2,5,1,3,6), (4,3,2,1,5,6).
		

Crossrefs

Diagonal of A213910.
Cf. A128566.

Programs

  • Maple
    T:= proc(n, k) option remember; `if`(n<0 or k<0, 0, `if`(k=0, 1,
          T(n-1, k) + add(T(n-2, k-2*(n-j)+1), j=1..n-1)))
        end:
    a:= n-> T(n$2):
    seq(a(n), n=0..50);
  • Mathematica
    Needs["Combinatorica`"];
    Table[Count[Map[Inversions,Involutions[n]],n],{n,0,12}]
    (* Second program: *)
    T[n_, k_] := T[n, k] = If[n < 0 || k < 0, 0, If[k == 0, 1, T[n-1, k] + Sum[T[n-2, k-2*(n-j)+1], {j, 1, n-1}]]];
    a[n_] := T[n, n];
    Table[a[n], {n, 0, 50}] (* Jean-François Alcover, Dec 04 2023, after Maple code *)

Formula

a(n) = T(n,n) with T(n,k) = T(n-1,k) + Sum_{j=1..n-1} T(n-2,k-2*(n-j)+1) for n>=0, k>0; T(n,k) = 0 for n<0 or k<0; T(n,0) = 1 for n>=0.
a(n) ~ c * d^n / sqrt(n), where d = 2.529010713480526199368... is the root of the equation 4 - 23*d - 36*d^2 - 8*d^3 + 4*d^5 = 0, c = 0.08933570507578447270759... . - Vaclav Kotesovec, Sep 07 2014

A128565 Column 1 of triangle A128564; a(n) equals the number of permutations of {1..n+2} with [n/2+1] inversions for n>=0.

Original entry on oeis.org

1, 2, 5, 9, 29, 49, 174, 285, 1068, 1717, 6655, 10569, 41926, 66013, 266338, 416687, 1703027, 2651355, 10947079, 16976806, 70673825, 109256095, 457927079, 706071989, 2976282415, 4579020513, 19395654894, 29784426945, 126688273871, 194231327451, 829176461458
Offset: 0

Views

Author

Paul D. Hanna, Mar 12 2007

Keywords

Crossrefs

Cf. A008302 (Mahonian numbers); A128564 (triangle), A128566 (column 2).

Programs

  • PARI
    {a(n)=polcoeff(prod(j=1, n+2, (1-q^j)/(1-q)),(n+2)\2,q)}

Formula

a(n) = A008302(n+2,[n/2+1]) = coefficient of q^[n/2+1] in the q-factorial of n+2 for n>=0.

A384368 Number of permutations of [2n] with n inversions.

Original entry on oeis.org

1, 1, 5, 29, 174, 1068, 6655, 41926, 266338, 1703027, 10947079, 70673825, 457927079, 2976282415, 19395654894, 126688273871, 829176461458, 5436687172806, 35703722618623, 234807844921153, 1546217013188447, 10193761267335877, 67275841673522196, 444431529264364506
Offset: 0

Views

Author

Alois P. Heinz, May 27 2025

Keywords

Examples

			a(0) = 1: the empty permutation.
a(1) = 1: 21.
a(2) = 5: 1342, 1423, 2143, 2314, 3124.
a(3) = 29: 123654, 124563, 124635, 125364, 125436, 126345, 132564, 132645, 134265, 134526, 135246, 142365, 142536, 143256, 152346, 213564, 213645, 214365, 214536, 215346, 231465, 231546, 234156, 241356, 312465, 312546, 314256, 321456, 412356.
		

Crossrefs

Programs

  • Maple
    a:= n-> coeff(series(mul((1-q^j)/(1-q), j=1..2*n), q, n+1), q, n):
    seq(a(n), n=0..23);

Formula

a(n) = A008302(2n,n).
a(n) ~ c * 3^(3*n - 1/2) / (sqrt(Pi*n) * 2^(2*n)), where c = QPochhammer(1/3) = A100220 = 0.5601260779279489449697922433141400143797363337983... - Vaclav Kotesovec, Jun 09 2025

A304781 a(n) = [x^n] (1/(1 - x)^n)*Product_{k>=1} (1 + x^k).

Original entry on oeis.org

1, 2, 6, 21, 75, 274, 1016, 3807, 14377, 54627, 208584, 799669, 3076167, 11867511, 45897145, 177888715, 690770763, 2686879415, 10466761637, 40828165464, 159453481037, 623427464093, 2439907421914, 9557831470082, 37472409664888, 147028505564603, 577302980976146
Offset: 0

Views

Author

Ilya Gutkovskiy, May 18 2018

Keywords

Comments

Number of partitions of n into odd parts with n + 1 kinds of 1.

Crossrefs

Programs

  • Mathematica
    Table[SeriesCoefficient[1/(1 - x)^n Product[(1 + x^k), {k, 1, n}], {x, 0, n}], {n, 0, 26}]
    Table[SeriesCoefficient[1/(1 - x)^n Product[1/(1 - x^(2 k - 1)), {k, 1, n}], {x, 0, n}], {n, 0, 26}]
    Table[SeriesCoefficient[1/(1 - x)^n Exp[Sum[(-1)^(k + 1) x^k/(k (1 - x^k)), {k, 1, n}]], {x, 0, n}], {n, 0, 26}]
    Table[SeriesCoefficient[QPochhammer[-1, x]/(2 (1 - x)^n), {x, 0, n}], {n, 0, 26}]

Formula

a(n) = [x^n] (1/(1 - x)^n)*Product_{k>=1} 1/(1 - x^(2*k-1)).
a(n) = [x^n] (1/(1 - x)^n)*exp(Sum_{k>=1} (-1)^(k+1)*x^k/(k*(1 - x^k))).
a(n) ~ QPochhammer[-1, 1/2] * 4^(n-1) / sqrt(Pi*n). - Vaclav Kotesovec, May 18 2018
Showing 1-7 of 7 results.