OFFSET
0,5
COMMENTS
Conjecture: The sequence of rational numbers A061057(n)/a(n) has 1 as a limit point. Question: What other limit points does the sequence have? - Richard Peterson, Jul 13 2023
LINKS
Max Alekseyev, Table of n, a(n) for n = 0..140 (terms for n = 0..60 from Peter J. Taylor)
FORMULA
EXAMPLE
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.
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) = 79200 - 78624 = 576.
MAPLE
a:= proc(n) local l, ll, g, gg, 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])); gg:= g(1, nops(l), 1); ll[n]/gg -gg end: a(0):=0:
seq(a(n), n=0..20); # Alois P. Heinz, Jul 09 2009, revised Oct 17 2015
MATHEMATICA
a[n_] := Module[{l, ll, g, gg, p, i}, l = Range[n]; ll = Array[Factorial, n]; g[m_, j_, b_] := g[m, j, b] = Module[{mm, bb, k}, If[j==1, m, mm=m; bb=b; For[k=1, mm<p, k++, If[j==2 || k==2 || k==1 && ll[[j-1]]*mm > bb , bb = Max[bb, g[mm, j-1, bb]]]; mm = mm*l[[j]]]; bb]]; p = Ceiling[Sqrt[ ll[[n]]]]; gg = g[1, Length[l], 1]; ll[[n]]/gg - gg]; a[0]=0; Table[an = a[n]; Print["a(", n, ") = ", an]; an, {n, 0, 35}] (* Jean-François Alcover, Feb 29 2016, after Alois P. Heinz *)
PROG
(Python)
from math import prod, factorial
from itertools import combinations
def A038667(n):
m = factorial(n)
return 0 if n == 0 else min(abs((p:=prod(d))-m//p) for l in range(n, n//2, -1) for d in combinations(range(1, n+1), l)) # Chai Wah Wu, Apr 06 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
EXTENSIONS
a(28)-a(31) from Alois P. Heinz, Jul 09 2009
a(1) and examples from Franklin T. Adams-Watters, Nov 22 2011
a(32)-a(33) from Alois P. Heinz, Nov 23 2011
a(34)-a(35) from Alois P. Heinz, Oct 17 2015
STATUS
approved