%I #33 May 16 2021 01:53:39
%S 1,0,0,691,3416,0,233,1168,0,8857,18157,0,2176512,3628118,0,3204865,
%T 8031495,0,79514209,205927212,0,5152732369,13493840291,0
%N Number of ways the first n cubes can be partitioned into three sets with equal sums.
%C Note the offset.
%D Keith F. Lynch, Posting to Math Fun Mailing List, Sep 17 2019.
%F a(n) > 0 => n in { A007494 }. - _Alois P. Heinz_, Sep 30 2019
%e The unique smallest solution (for n = 23) is
%e 27 + 216 + 1000 + 2197 + 5832 + 6859 + 9261 =
%e 1 + 64 + 343 + 512 + 1728 + 4096 + 8000 + 10648 =
%e 8 + 125 + 729 + 1331 + 2744 + 3375 + 4913 + 12167.
%p s:= proc(n) option remember; `if`(n<2, 0, n^3+s(n-1)) end:
%p b:= proc(n, x, y) option remember; `if`(n=1, 1, (p-> (l->
%p add(`if`(p>l[i], 0, b(n-1, sort(subsop(i=l[i]-p, l))
%p [1..2][])), i=1..3))([x, y, s(n)-x-y]))(n^3))
%p end:
%p a:= n-> `if`(irem(1+s(n), 3, 'q')=0, b(n, q-1, q)/2, 0):
%p seq(a(n), n=23..27); # _Alois P. Heinz_, Sep 30 2019
%t s[n_] := s[n] = If[n < 2, 0, n^3 + s[n - 1]];
%t b[n_, x_, y_] := b[n, x, y] = If[n == 1, 1, With[{p = n^3}, Sum[If[p > #[[i]], 0, b[n - 1, Sequence @@ Sort[ReplacePart[#, i -> #[[i]] - p]][[1 ;; 2]]]], {i, 1, 3}]]&[{x, y, s[n] - x - y}]];
%t a[n_] := a[n] = If[q = Quotient[1 + s[n], 3]; Mod[1 + s[n], 3] == 0, b[n, q - 1, q]/2, 0];
%t Table[Print[n, " ", a[n]]; a[n], {n, 23, 34}] (* _Jean-François Alcover_, Nov 08 2020, after _Alois P. Heinz_ *)
%Y Cf. A000537, A000578, A007494, A112972, A275714, A113263, A327449, A327450.
%K nonn,more
%O 23,4
%A _N. J. A. Sloane_, Sep 19 2019
%E a(32), a(33), a(35) recomputed and a(36)-a(38) added by _Alois P. Heinz_, Sep 30 2019
%E a(39)-a(46) from _Bert Dobbelaere_, May 15 2021