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.

A038041 Number of ways to partition an n-set into subsets of equal size.

This page as a plain text file.
%I A038041 #70 Sep 26 2024 12:58:14
%S A038041 1,2,2,5,2,27,2,142,282,1073,2,32034,2,136853,1527528,4661087,2,
%T A038041 227932993,2,3689854456,36278688162,13749663293,2,14084955889019,
%U A038041 5194672859378,7905858780927,2977584150505252,13422745388226152,2,1349877580746537123,2
%N A038041 Number of ways to partition an n-set into subsets of equal size.
%C A038041 a(n) = 2 iff n is prime with a(p) = card{ 1|2|3|...|p-1|p, 123...p } = 2. - _Bernard Schott_, May 16 2019
%H A038041 Alois P. Heinz, <a href="/A038041/b038041.txt">Table of n, a(n) for n = 1..250</a>
%H A038041 Gus Wiseman, <a href="/A038041/a038041.txt">Sequences counting and ranking multiset partitions whose part lengths, sums, or averages are constant or strict.</a>
%F A038041 a(n) = Sum_{d divides n} (n!/(d!*((n/d)!)^d)).
%F A038041 E.g.f.: Sum_{k >= 1} (exp(x^k/k!)-1).
%e A038041 a(4) = card{ 1|2|3|4, 12|34, 14|23, 13|24, 1234 } = 5.
%e A038041 From _Gus Wiseman_, Jul 12 2019: (Start)
%e A038041 The a(6) = 27 set partitions:
%e A038041   {{1}{2}{3}{4}{5}{6}}  {{12}{34}{56}}  {{123}{456}}  {{123456}}
%e A038041                         {{12}{35}{46}}  {{124}{356}}
%e A038041                         {{12}{36}{45}}  {{125}{346}}
%e A038041                         {{13}{24}{56}}  {{126}{345}}
%e A038041                         {{13}{25}{46}}  {{134}{256}}
%e A038041                         {{13}{26}{45}}  {{135}{246}}
%e A038041                         {{14}{23}{56}}  {{136}{245}}
%e A038041                         {{14}{25}{36}}  {{145}{236}}
%e A038041                         {{14}{26}{35}}  {{146}{235}}
%e A038041                         {{15}{23}{46}}  {{156}{234}}
%e A038041                         {{15}{24}{36}}
%e A038041                         {{15}{26}{34}}
%e A038041                         {{16}{23}{45}}
%e A038041                         {{16}{24}{35}}
%e A038041                         {{16}{25}{34}}
%e A038041 (End)
%p A038041 A038041 := proc(n) local d;
%p A038041 add(n!/(d!*(n/d)!^d), d = numtheory[divisors](n)) end:
%p A038041 seq(A038041(n),n = 1..29); # _Peter Luschny_, Apr 16 2011
%t A038041 a[n_] := Block[{d = Divisors@ n}, Plus @@ (n!/(#! (n/#)!^#) & /@ d)]; Array[a, 29] (* _Robert G. Wilson v_, Apr 16 2011 *)
%t A038041 Table[Sum[n!/((n/d)!*(d!)^(n/d)), {d, Divisors[n]}], {n, 1, 31}] (* _Emanuele Munarini_, Jan 30 2014 *)
%t A038041 sps[{}]:={{}};sps[set:{i_,___}]:=Join@@Function[s,Prepend[#,s]&/@sps[Complement[set,s]]]/@Cases[Subsets[set],{i,___}];
%t A038041 Table[Length[Select[sps[Range[n]],SameQ@@Length/@#&]],{n,0,8}] (* _Gus Wiseman_, Jul 12 2019 *)
%o A038041 (PARI)  /* compare to A061095 */
%o A038041 mnom(v)=
%o A038041 /* Multinomial coefficient s! / prod(j=1, n, v[j]!) where
%o A038041   s= sum(j=1, n, v[j]) and n is the number of elements in v[]. */
%o A038041 sum(j=1, #v, v[j])! / prod(j=1, #v, v[j]!)
%o A038041 A038041(n)={local(r=0);fordiv(n,d,r+=mnom(vector(d,j,n/d))/d!);return(r);}
%o A038041 vector(33,n,A038041(n)) /* _Joerg Arndt_, Apr 16 2011 */
%o A038041 (Maxima) a(n):= lsum(n!/((n/d)!*(d!)^(n/d)),d,listify(divisors(n)));
%o A038041 makelist(a(n),n,1,40); /* _Emanuele Munarini_, Feb 03 2014 */
%o A038041 (Python)
%o A038041 import math
%o A038041 def a(n):
%o A038041     count = 0
%o A038041     for k in range(1, n + 1):
%o A038041         if n % k == 0:
%o A038041             count += math.factorial(n) // (math.factorial(k) ** (n // k) * math.factorial(n // k))
%o A038041     return count # _Paul Muljadi_, Sep 25 2024
%Y A038041 Cf. A061095 (same but with labeled boxes), A005225, A236696, A055225, A262280, A262320.
%Y A038041 Column k=1 of A208437.
%Y A038041 Row sums of A200472 and A200473.
%Y A038041 Cf. A000110, A007837 (different lengths), A035470 (equal sums), A275780, A317583, A320324, A322794, A326512 (equal averages), A326513.
%K A038041 nonn,easy
%O A038041 1,2
%A A038041 _Christian G. Bower_
%E A038041 More terms from _Erich Friedman_