%I #22 Sep 08 2022 08:45:28
%S 2,2,2,2,4,4,12,20,16,24,64,96,144,128,320,384,512,1008,1296,1024,
%T 2700,2592,4800,6144,8448,12672
%N Maximum number of divisors of Product(a_i) + Product(b_j) over all (disjoint) partitions of {1..n} into {a_i} and {b_j}.
%C Answering a question asked by _Leroy Quet_ in rec.puzzles on 2007-01-05.
%C The terms were also calculated by Peter Pein and _Jan Kristian Haugland_.
%H Leroy Quet, <a href="http://groups.google.com.au/group/rec.puzzles/msg/261178ba23034b9b">Multiply-Then-Add "Game"</a>, USENET post to rec.puzzles.
%e a(1) = 2 because the product over the empty set is defined here as 1. So we have a(1) = number of divisors of (1+1).
%e For n = 6 the maximum number of divisors occurs when S = 1*3*4*5 + 2*6 = 72. (This 12-divisor solution is not unique.) So a(6) is the number of positive divisors of 72, which is 12.
%e a(7) = 20 because of the partition 3*4 + 2*5*6*7 = 432, which has 20 divisors (and no other partition yields more).
%p A125584 := proc(n) local bc,a,b,c,i,j,bL,S,bsiz ; a := 0 ; bc := {seq(i,i=1..n)} ; for bsiz from 0 to floor(n/2) do bL := combinat[choose](bc,bsiz) ; for i from 1 to nops(bL) do b := convert(op(i,bL),set) ; c := bc minus b ; if nops(b) = 0 then b := 1; else b := mul(j,j=b) ; fi ; if nops(c) = 0 then c := 1; else c := mul(j,j=c) ; fi ; S := numtheory[tau](c+b) ; a := max(a,S) ; od: od: RETURN(a) ; end: for n from 1 do A125584(n) ; od; # _R. J. Mathar_, Nov 11 2007
%t a[n_] := a[n] = Table[DivisorSigma[0, Times @@ sr + Times @@ Complement[ Range[n], sr]], {sr, Subsets[Range[n], n]}] // Max;
%t Table[Print[n, " ", a[n]]; a[n], {n, 0, 25}] (* _Jean-François Alcover_, Apr 10 2020 *)
%o (Magma) [ n lt 3 select 2 else Max([NumberOfDivisors(x + (Factorial(n) div x)) where x is &*s : s in Subsets({3..n}) ] : n in [0..20] ];
%o (PARI) a(n)={my(m=0); forsubset(max(0, n-2), s, my(t=prod(i=1, #s, s[i]+1)); m=max(m, numdiv(t + n!/t))); m} \\ _Andrew Howroyd_, Jan 28 2020
%K nonn,more
%O 0,1
%A Geoff Bailey (geoff(AT)maths.usyd.edu.au), Jan 04 2007
%E 2 more terms from _R. J. Mathar_, Nov 11 2007
%E Edited by _N. J. A. Sloane_, Jul 03 2008 at the suggestion of _R. J. Mathar_
%E a(23)-a(25) from _Andrew Howroyd_, Jan 28 2020