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

A129530 a(n) = (1/2)*n*(n-1)*3^(n-1).

Original entry on oeis.org

0, 0, 3, 27, 162, 810, 3645, 15309, 61236, 236196, 885735, 3247695, 11691702, 41452398, 145083393, 502211745, 1721868840, 5854354056, 19758444939, 66248903619, 220829678730, 732224724210, 2416341589893, 7939408081077
Offset: 0

Views

Author

Emeric Deutsch, Apr 22 2007

Keywords

Comments

Number of inversions in all ternary words of length n on {0,1,2}. Example: a(2)=3 because each of the words 10,20,21 has one inversion and the words 00,01,02,11,12,22 have no inversions. a(n)=3*A027472(n+1). a(n)=Sum(k*A129529(n,k),k>=0).

Crossrefs

Programs

  • Maple
    seq(n*(n-1)*3^(n-1)/2,n=0..27);
  • Mathematica
    Table[(n(n-1)3^(n-1))/2,{n,0,30}] (* or *) LinearRecurrence[{9,-27,27},{0,0,3},30] (* Harvey P. Dale, Dec 18 2013 *)
  • PARI
    a(n)=n*(n-1)*3^(n-1)/2 \\ Charles R Greathouse IV, Oct 16 2015

Formula

G.f.: 3x^2/(1-3x)^3.
a(0)=0, a(1)=0, a(2)=3, a(n)=9*a(n-1)-27*a(n-2)+27*a(n-3). - Harvey P. Dale, Dec 18 2013
From Amiram Eldar, Jan 12 2021: (Start)
Sum_{n>=2} 1/a(n) = 2 * (1 - 2 * log(3/2)).
Sum_{n>=2} (-1)^n/a(n) = 2*(4*log(4/3) - 1). (End)
a(n) = 3*A027472(n+1). - R. J. Mathar, Jul 26 2022

A129529 Triangle read by rows: T(n,k) is the number of ternary words of length n on {0,1,2} that have k inversions (n >= 0, k >= 0).

Original entry on oeis.org

1, 3, 6, 3, 10, 8, 8, 1, 15, 15, 21, 18, 9, 3, 21, 24, 39, 45, 48, 30, 24, 9, 3, 28, 35, 62, 82, 107, 108, 101, 81, 62, 37, 17, 8, 1, 36, 48, 90, 129, 186, 222, 264, 252, 255, 219, 183, 126, 90, 48, 27, 9, 3, 45, 63, 123, 186, 285, 372, 492, 561, 624, 648, 651, 597, 537, 435, 336, 249, 165, 99, 54, 27, 9, 3
Offset: 0

Views

Author

Emeric Deutsch, Apr 22 2007

Keywords

Comments

Row n has 1 + floor(n^2/3) terms.
Row sums are equal to 3^n = A000244(n).
Alternating row sums are 3^(ceiling(n/2)) = A108411(n+1).
This sequence is mentioned in the Andrews-Savage-Wilf paper. - Omar E. Pol, Jan 30 2012

Examples

			T(3,2) = 8 because we have 100, 110, 120, 200, 201, 211, 220 and 221.
Triangle starts:
   1;
   3;
   6,  3;
  10,  8,  8,  1;
  15, 15, 21, 18,  9,  3;
  21, 24, 39, 45, 48, 30, 24,  9,  3;
  ...
		

References

  • M. Bona, Combinatorics of Permutations, Chapman & Hall/CRC, Boca Raton, FL, 2004, pp. 57-61.
  • G. E. Andrews, The Theory of Partitions, Addison-Wesley, 1976.

Crossrefs

Programs

  • Maple
    for n from 0 to 40 do br[n]:=sum(q^i,i=0..n-1) od: for n from 0 to 40 do f[n]:=simplify(product(br[j],j=1..n)) od: mbr:=(n,a,b,c)->simplify(f[n]/f[a]/f[b]/f[c]): for n from 0 to 9 do G[n]:=sort(simplify(sum(sum(mbr(n,a,b,n-a-b),b=0..n-a),a=0..n))) od: for n from 0 to 9 do seq(coeff(G[n],q,j),j=0..floor(n^2/3)) od; # yields sequence in triangular form
    # second Maple program:
    b:= proc(n, l) option remember; `if`(n=0, 1, add(expand(b(n-1, `if`(j<3,
          subsop(j=l[j]+1, l), l)))*x^([0, l[1], l[1]+l[2]][j]), j=1..3))
        end:
    T:= n-> (p-> seq(coeff(p, x, i), i=0..degree(p)))(b(n, [0$2])):
    seq(T(n), n=0..10);  # Alois P. Heinz, Feb 12 2025
  • Mathematica
    b[n_, l_] := b[n, l] =
       If[n == 0, 1, Sum[Expand[b[n-1, If[j < 3, ReplacePart[l, j -> l[[j]]+1], l]]]*x^({0, l[[1]], l[[1]]+l[[2]]}[[j]]), {j, 1, 3}]];
    T[n_] := With[{p = b[n, {0, 0}]}, Table[Coefficient[p, x, i], {i, 0, Exponent[p, x]}]];
    Table[T[n], {n, 0, 10}] // Flatten (* Jean-François Alcover, Apr 13 2025, after Alois P. Heinz *)

Formula

T(n,0) = (n+1)*(n+2)/2 = A000217(n+1).
Sum_{k>=0} k*T(n,k) = 3^(n-1)*n*(n-1)/2 = A129530(n).
Generating polynomial of row n is Sum_{i=0..n} Sum_{j=0..n-i} binomial[n; i,j,n-i-j], where binomial[n;a,b,c] (a+b+c=n) is a q-multinomial coefficient.
Sum_{k=0..floor(n^2/3)} (-1)^k * T(n,k) = A056449(n). - Alois P. Heinz, Feb 12 2025

A129531 Triangle read by rows: T(n,k) is the number of 4-ary words of length n on {0,1,2,3} having k inversions (n >= 0, k >= 0).

Original entry on oeis.org

1, 4, 10, 6, 20, 20, 20, 4, 35, 45, 65, 60, 35, 15, 1, 56, 84, 144, 180, 200, 152, 120, 60, 24, 4, 84, 140, 266, 386, 526, 584, 590, 524, 424, 290, 164, 86, 26, 6, 120, 216, 440, 700, 1064, 1384, 1720, 1844, 1940, 1820, 1616, 1272, 956, 620, 380, 184, 80, 24, 4
Offset: 0

Views

Author

Emeric Deutsch, Apr 22 2007

Keywords

Comments

Row n has (apparently) ceiling((3n^2+4)/8) terms.
Row sums are equal to 4^n = A000302(n).
Alternating row sums are 4^(ceiling(n/2)).
T(n,0) = (n+1)*(n+2)(n+3)/6 = A000292(n+1).
Sum_{k>=0} k*T(n,k) = 3*n*(n-1)*4^(n-2) = A129532(n).
This sequence is mentioned in the Andrews-Savage-Wilf paper. - Omar E. Pol, Jan 30 2012

Examples

			T(2,1)=6 because we have 10, 20, 30, 21, 31 and 32.
Triangle starts:
   1;
   4;
  10,   6;
  20,  20,  20,   4;
  35,  45,  65,  60,  35,  15,   1;
  56,  84, 144, 180, 200, 152, 120,  60,  24,   4;
		

References

  • G. E. Andrews, The Theory of Partitions, Addison-Wesley, 1976.
  • M. Bona, Combinatorics of Permutations, Chapman & Hall/CRC, Boca Raton, FL, 2004, pp. 57-61.

Crossrefs

Programs

  • Maple
    for n from 0 to 12 do br[n]:=sum(q^i,i=0..n-1) od: for n from 0 to 12 do f[n]:=simplify(product(br[j],j=1..n)) od: mbr:=(n,a,b,c,d)->simplify(f[n]/f[a]/f[b]/f[c]/f[d]): for n from 0 to 8 do G[n]:=sort(simplify(sum(sum(sum(mbr(n,a,b,c,n-a-b-c),c=0..n-a-b),b=0..n-a),a=0..n))) od: for n from 0 to 8 do seq(coeff(G[n],q,j),j=0..ceil((3*n^2-4)/8)) od; # yields sequence in triangular form

Formula

Generating polynomial of row n is Sum_{a=0..n} Sum_{b=0..n-a} Sum_{c=0..n-a-b} binomial[n; a,b,c,n-a-b-c], where binomial[n;a,b,c,d] (a+b+c+d=n) is a q-multinomial coefficient.

A181372 Square array read by antidiagonals: a(p,n) is the number of inversions in all p-ary words of length n on {0,1,2,...,p-1} (p>=2, n>=2).

Original entry on oeis.org

1, 3, 6, 6, 27, 24, 10, 72, 162, 80, 15, 150, 576, 810, 240, 21, 270, 1500, 3840, 3645, 672, 28, 441, 3240, 12500, 23040, 15309, 1792, 36, 672, 6174, 32400, 93750, 129024, 61236, 4608, 45, 972, 10752, 72030, 291600, 656250, 688128, 236196, 11520
Offset: 2

Views

Author

Emeric Deutsch, Oct 31 2010

Keywords

Comments

a(2,n)=A001788(n-1).
a(3,n)=A129530(n).
a(4,n)=A129532(n).

Examples

			a(2,3)=6 because the words 010, 100, 101, 110 have 1, 2, 1, 2 inversions, respectively, while 000, 001, 011 and 111 have none.
a(3,2)=3 because each of the words 10, 20, 21 has 1 inversion, while 00, 01, 02, 11, 12, 22 have none.
Square array starts:
1,6,24,80,240, ...;
3,27,162,810,3645, ... ;
6,72,576, 3840,23040, ... ;
10,150,1500,12500, 93750,...;
		

Crossrefs

Programs

  • Maple
    a := proc (p, n) options operator, arrow: (1/4)*n*(n-1)*(p-1)*p^(n-1) end proc: for p from 2 to 8 do seq(a(p, n), n = 2 .. 8) end do; # yields the first seven rows and seven columns of the square array

Formula

a(p,n)=n(n-1)(p-1)p^{n-1}/4.
Showing 1-4 of 4 results.