A217194
Number of unlabeled simple graphs with n nodes of 2 colors whose components are path graphs.
Original entry on oeis.org
1, 2, 6, 16, 42, 106, 267, 656, 1602, 3868, 9270, 22048, 52140, 122580, 286798, 667944, 1549259, 3579738, 8242638, 18917600, 43286909, 98768820, 224768425, 510235760, 1155553468, 2611251662, 5888421059, 13252176464, 29768501556, 66749440076, 149415504274
Offset: 0
a(3) = 16 because we have:
w w w; w w b; w b b; b b b;
w w-w; w w-b; w b-b; b w-w; b w-b; b b-b;
w-w-w; w-w-b; w-b-w; b-w-b; b-b-w; b-b-b, where the 2 colors are black b and white w.
-
with(numtheory):
a:= proc(n) option remember; `if`(n=0, 1, add(add(d*(2^(d-1)+
2^(floor((d+1)/2)-1)), d=divisors(j))*a(n-j), j=1..n)/n)
end:
seq(a(n), n=0..30); # Alois P. Heinz, Sep 27 2012
-
nn=30;p=Product[1/(1- x^i)^(2^(i-1)+2^(Floor[(i+1)/2]-1)),{i,1,nn}];CoefficientList[Series[p,{x,0,nn}],x]
A217201
Number of simple unlabeled graphs with n nodes of 2 colors whose components are cycles.
Original entry on oeis.org
1, 0, 0, 4, 6, 8, 23, 42, 83, 166, 324, 622, 1236, 2366, 4595, 8900, 17225, 33212, 64376, 124360, 240819, 466284, 904149, 1753782, 3407225, 6623274, 12892131, 25116456, 48987833, 95633480, 186891367, 365549578, 715661254, 1402246154, 2749778317, 5396266284
Offset: 0
-
with (numtheory):
b:= n-> `if`(n<3, 0, add(phi(d)*2^(n/d)/(2*n), d=divisors(n))+
`if`(irem(n, 2)=1, 2^((n-1)/2), 2^(n/2-1)+2^(n/2-2))):
a:= proc(n) option remember; local d, j; `if`(n=0, 1,
add(add(d*b(d), d=divisors(j))*a(n-j), j=1..n)/n)
end:
seq(a(n), n=0..40); # Alois P. Heinz, Sep 27 2012
-
Needs["Combinatorica`"]
a=Expand[Table[nn=n;CycleIndex[DihedralGroup[nn],s]/.Table[s[i]->2,{i,1,nn}],{n,1,30}]];
nn=30;p=Product[1/(1- x^i)^a[[i]],{i,3,nn}];CoefficientList[Series[p,{x,0,nn}],x]
(* Second program: *)
b[n_] := If[n < 3, 0, Sum[EulerPhi[d]*2^(n/d)/(2*n), {d, Divisors[n]}] + If[Mod[n, 2] == 1, 2^((n - 1)/2), 2^(n/2 - 1) + 2^(n/2 - 2)]];
a[n_] := a[n] = If[n == 0, 1, Sum[Sum[d*b[d], {d, Divisors[j]}]*a[n - j], {j, 1, n}]/n];
Table[a[n], {n, 0, 40}] (* Jean-François Alcover, Nov 05 2017, after Alois P. Heinz *)
A382340
Triangle read by rows: T(n,k) is the number of partitions of a 3-colored set of n objects into exactly k parts with 0 <= k <= n.
Original entry on oeis.org
1, 0, 3, 0, 6, 6, 0, 10, 18, 10, 0, 15, 51, 36, 15, 0, 21, 105, 123, 60, 21, 0, 28, 208, 326, 226, 90, 28, 0, 36, 360, 771, 678, 360, 126, 36, 0, 45, 606, 1641, 1836, 1161, 525, 168, 45, 0, 55, 946, 3271, 4431, 3403, 1775, 721, 216, 55, 0, 66, 1446, 6096, 10026, 8982, 5472, 2520, 948, 270, 66
Offset: 0
Triangle starts:
0 : [1]
1 : [0, 3]
2 : [0, 6, 6]
3 : [0, 10, 18, 10]
4 : [0, 15, 51, 36, 15]
5 : [0, 21, 105, 123, 60, 21]
6 : [0, 28, 208, 326, 226, 90, 28]
7 : [0, 36, 360, 771, 678, 360, 126, 36]
8 : [0, 45, 606, 1641, 1836, 1161, 525, 168, 45]
9 : [0, 55, 946, 3271, 4431, 3403, 1775, 721, 216, 55]
10 : [0, 66, 1446, 6096, 10026, 8982, 5472, 2520, 948, 270, 66]
...
-
b:= proc(n, i) option remember; expand(`if`(n=0, 1, `if`(i<1, 0, add(
b(n-i*j, min(n-i*j, i-1))*binomial(i*(i+3)/2+j, j)*x^j, j=0..n/i))))
end:
T:= (n, k)-> coeff(b(n$2), x, k):
seq(seq(T(n, k), k=0..n), n=0..10); # Alois P. Heinz, Mar 22 2025
-
b[n_, i_] := b[n, i] = Expand[If[n == 0, 1, If[i < 1, 0, Sum[b[n - i*j, Min[n - i*j, i - 1]]*Binomial[i*(i + 3)/2 + j, j]*x^j, {j, 0, n/i}]]]];
T[n_, k_] := Coefficient[b[n, n], x, k];
Table[Table[T[n, k], {k, 0, n}], {n, 0, 10}] // Flatten (* Jean-François Alcover, Apr 17 2025, after Alois P. Heinz *)
-
from sympy import binomial
from sympy.utilities.iterables import partitions
colors = 3 - 1 # the number of colors - 1
def t_row( n):
if n == 0 : return [1]
t = list( [0] * n)
for p in partitions( n):
fact = 1
s = 0
for k in p :
s += p[k]
fact *= binomial( binomial( k + colors, colors) + p[k] - 1, p[k])
if s > 0 :
t[s - 1] += fact
return [0] + t
Comments