A112972 Number of ways the set {1,2,...,n} can be split into three subsets of equal sums.
0, 0, 0, 0, 1, 1, 0, 3, 9, 0, 43, 102, 0, 595, 1480, 0, 9294, 23728, 0, 157991, 411474, 0, 2849968, 7562583, 0, 53987864, 145173095, 0, 1061533318, 2885383960, 0, 21515805520, 59003023409, 0, 447142442841, 1235311936936, 0, 9489835046489, 26382363207307
Offset: 1
Keywords
Examples
For n=8 we have 84/75/6321, 84/732/651 and 831/75/642 so a(8)=3.
Links
- Alois P. Heinz, Table of n, a(n) for n = 1..125
Crossrefs
Programs
-
Maple
A112972:= n-> coeff(coeff(mul((x^(-2*k)+x^k*(y^k+y^(-k))) , k=1..n), x, 0), y, 0)/6: seq(A112972(n), n=1..20); # second Maple program: b:= proc() option remember; local i, j, t; `if`(args[1]=0, `if`(nargs=2, 1, b(args[t] $t=2..nargs)), add( `if`(args[j] -args[nargs]<0, 0, b(sort([seq(args[i]- `if`(i=j, args[nargs], 0), i=1..nargs-1)])[], args[nargs]-1)), j=1..nargs-1)) end: a:= n-> (m-> `if`(irem(m, 3)=0, b((m/3)$3, n)/6, 0))(n*(n+1)/2): seq(a(n), n=1..42); # Alois P. Heinz, Sep 03 2009
-
Mathematica
b[args_List] := b[args] = Module[{nargs = Length[args]}, If[args[[1]] == 0, If[nargs == 2, 1, b[args // Rest]], Sum[If[args[[j]] - Last[args] < 0, 0, b[Append[Sort[Flatten[Table[args[[i]] - If[i == j, Last[args], 0], {i, 1, nargs-1}]]], Last[args]-1]]], {j, 1, nargs-1}]]]; a[n_] := If[Mod[#, 3] == 0, b[{#/3, #/3, #/3, n}]/6, 0]&[n(n+1)/2]; Array[a, 42] (* Jean-François Alcover, Oct 30 2020, after Alois P. Heinz *)
Formula
a(n) is 1/6 of the coefficient of x^0*y^0 in Product_{k=1..n} (x^(-2*k)+x^k*(y^k+y^(-k))).
Extensions
Extended beyond a(25) by Alois P. Heinz, Sep 03 2009