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.
%I A200743 #54 Jul 15 2023 16:56:55 %S A200743 1,1,2,4,10,24,70,192,576,1890,6300,21600,78624,294840,1140480, %T A200743 4561920,18849600,79968000,348566400,1559376000,7147140000, %U A200743 33522128640,160745472000,787652812800,3938264064000,20080974513600,104348244639744,552160113120000,2973491173785600,16286186592000000,90678987245246400 %N A200743 Divide integers 1..n into two sets, minimizing the difference of their products. This sequence is the smaller product. %H A200743 Max Alekseyev, <a href="/A200743/b200743.txt">Table of n, a(n) for n = 1..140</a> (terms for n=1..35 from Michael S. Branicky) %F A200743 a(n) = A127180(n) - A200744(n) = A200744(n) - A038667(n) = (A127180(n) - A038667(n)) / 2. - _Max Alekseyev_, Jun 18 2022 %e A200743 For n=1, we put 1 in one set and the other is empty; with the standard convention for empty products, both products are 1. %e A200743 For n=13, the central pair of divisors of n! are 78975 and 78848. Since neither is divisible by 10, these values cannot be obtained. The next pair of divisors are 79200 = 12*11*10*6*5*2*1 and 78624 = 13*9*8*7*4*3, so a(13) = 78624. %p A200743 a:= proc(n) local l, ll, g, p, i; l:= [i$i=1..n]; ll:= [i!$i=1..n]; g:= proc(m, j, b) local mm, bb, k; if j=1 then m else mm:= m; bb:= b; for k to 2 while (mm<p) do if j=2 or k=2 or k=1 and ll[j-1]*mm>bb then bb:= max(bb, g(mm, j-1, bb)) fi; mm:= mm*l[j] od; bb fi end; Digits:= 700; p:= ceil(sqrt(ll[n])); g(1, nops(l), 1) end: seq(a(n), n=1..23); # _Alois P. Heinz_, Nov 22 2011 %t A200743 a[n_] := a[n] = Module[{s, t}, {s, t} = MinimalBy[{#, Complement[Range[n], #]}& /@ Subsets[Range[n]], Abs[Times @@ #[[1]] - Times @@ #[[2]]]&][[1]]; Min[Times @@ s, Times @@ t]]; %t A200743 Table[Print[n, " ", a[n]]; a[n], {n, 1, 25}] (* _Jean-François Alcover_, Nov 03 2020 *) %o A200743 (Python) %o A200743 from itertools import combinations %o A200743 def prod(l): %o A200743 t=1 %o A200743 for x in l: %o A200743 t *= x %o A200743 return t %o A200743 def a200743(n): %o A200743 nums = list(range(1,n+1)) %o A200743 widths = combinations(nums,n//2) %o A200743 dimensions = [(prod(width),prod(x for x in nums if x not in width)) for width in widths] %o A200743 best = min(dimensions,key=lambda x:max(*x)-min(*x)) %o A200743 return min(best) %o A200743 # _Christian Perfect_, Feb 04 2015 %o A200743 (Python) %o A200743 from math import prod, factorial %o A200743 from itertools import combinations %o A200743 def A200743(n): %o A200743 m = factorial(n) %o A200743 return min((abs((p:=prod(d))-m//p),min(p,m//p)) for l in range(n,n//2,-1) for d in combinations(range(1,n+1),l))[1] # _Chai Wah Wu_, Apr 07 2022 %Y A200743 Cf. A060776, A038667, A127180, A200744. %K A200743 nonn %O A200743 1,3 %A A200743 _Franklin T. Adams-Watters_, Nov 21 2011 %E A200743 a(24)-a(30) from _Alois P. Heinz_, Nov 22 2011 %E A200743 a(31) from _Michael S. Branicky_, May 21 2021