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.

A381891 Triangle read by rows: T(n,k) is the number of partitions of a 2-colored set of n objects into at most k parts with 0 <= k <= n.

This page as a plain text file.
%I A381891 #30 Mar 26 2025 15:27:10
%S A381891 1,0,2,0,3,6,0,4,10,14,0,5,19,28,33,0,6,28,52,64,70,0,7,44,93,127,142,
%T A381891 149,0,8,60,152,228,272,290,298,0,9,85,242,404,507,561,582,591,0,10,
%U A381891 110,370,672,904,1034,1098,1122,1132,0,11,146,546,1100,1568,1870,2027,2101,2128,2139
%N A381891 Triangle read by rows: T(n,k) is the number of partitions of a 2-colored set of n objects into at most k parts with 0 <= k <= n.
%C A381891 The 1-color case is Euler's table A026820.
%H A381891 Alois P. Heinz, <a href="/A381891/b381891.txt">Rows n = 0..150, flattened</a>
%F A381891 T(1,k) = k + 1.
%F A381891 T(n,n) = A005380(n).
%e A381891 Triangle begins:
%e A381891   1;
%e A381891   0, 2;
%e A381891   0, 3,  6;
%e A381891   0, 4, 10,  14;
%e A381891   0, 5, 19,  28,  33;
%e A381891   0, 6, 28,  52,  64,  70;
%e A381891   0, 7, 44,  93, 127, 142, 149;
%e A381891   0, 8, 60, 152, 228, 272, 290, 298;
%e A381891   ...
%p A381891 b:= proc(n, i) option remember; expand(`if`(n=0 or i=1, (n+1)*x^n,
%p A381891       add(b(n-i*j, min(n-i*j, i-1))*binomial(i+j, j)*x^j, j=0..n/i)))
%p A381891     end:
%p A381891 T:= proc(n, k) option remember;
%p A381891       `if`(k<0, 0, T(n, k-1)+coeff(b(n$2), x, k))
%p A381891     end:
%p A381891 seq(seq(T(n, k), k=0..n), n=0..10);  # _Alois P. Heinz_, Mar 09 2025
%o A381891 (Python)
%o A381891 from sympy import binomial
%o A381891 from sympy.utilities.iterables import partitions
%o A381891 from sympy.combinatorics.partitions import IntegerPartition
%o A381891 def a381891_row( n):
%o A381891     if n == 0 : return [1]
%o A381891     t = list( [0] * n)
%o A381891     for p in partitions( n):
%o A381891         p = IntegerPartition( p).as_dict()
%o A381891         fact = 1
%o A381891         s = 0
%o A381891         for k in p :
%o A381891             s += p[k]
%o A381891             fact *= binomial( k + p[k], p[k])
%o A381891         if s > 0 :
%o A381891             t[s - 1] += fact
%o A381891     for i in range( n - 1):
%o A381891         t[i+1] += t[i]
%o A381891     return [0] + t
%Y A381891 Cf. A005380, A026820.
%K A381891 nonn,tabl
%O A381891 0,3
%A A381891 _Peter Dolland_, Mar 09 2025