%I #69 Jul 20 2023 21:39:21
%S 0,1,1,2,2,6,2,18,54,30,36,576,127,840,928,3712,20160,93696,420480,
%T 800640,1305696,7983360,55056804,65318400,326592000,2286926400,
%U 2610934480,13680979200,18906930876,674165366496,326850970500,16753029012720,16880461678080
%N Factorial splitting: write n! = x*y with x <= y and x maximal; sequence gives value of y-x.
%C Difference between central divisors of n!. - _Jaume Oliver Lafont_, Mar 13 2009
%C For n > 1, n! will never be a square, because of primes in the last half of the factors. Therefore the divisors of n! come in pairs (x,y) with x*y = n! and x < y. The sequence gives the difference y-x between the pair nearest to the square root of n!. - _Alois P. Heinz_, Jul 06 2009
%C a(n) = 2 iff n belongs to A146968. - _Max Alekseyev_, Feb 06 2010
%H Max Alekseyev, <a href="/A061057/b061057.txt">Table of n, a(n) for n = 1..140</a>
%F a(n) = A060777(n) - A060776(n).
%F a(n) = A056737(A000142(n)). - _Pontus von Brömssen_, Jul 15 2023
%e 2! = 1*2, with difference of 1.
%e 3! = 2*3, with difference of 1.
%e 4! = 4*6, with difference of 2.
%e 5! = 10*12, with difference of 2.
%e 6! = 24*30, with difference of 6.
%e 7! = 70*72 with difference of 2.
%e The corresponding central divisors are two units apart (equivalently, n!+1=A038507(n) is a square) for n = 4, 5, 7 (see A146968).
%p A060777 := proc(n) local d,nd ; d := sort(convert(numtheory[divisors](n!),list)) ; nd := nops(d) ; op(floor(1+nd/2),d) ; end:
%p A060776 := proc(n) local d,nd ; d := sort(convert(numtheory[divisors](n!),list)) ; nd := nops(d) ; op(floor(nd/2),d) ; end:
%p A061057 := proc(n) A060777(n)-A060776(n) ; end:
%p seq(A061057(n),n=2..27) ; # _R. J. Mathar_, Mar 14 2009
%t Do[ With[ {k = Floor[ Sqrt[ x! ] ] - Do[ If[ Mod[ x!, Floor[ Sqrt[ x! ] ] - n ] == 0, Return[ n ] ], {n, 0, 10000000} ]}, Print[ {x, "! =", k, x!/k, x!/k - k} ] ], {x, 3, 22} ]
%t f[n_] := Block[{k = Floor@ Sqrt[n! ]}, While[ Mod[n!, k] != 0, k-- ]; n!/k - k]; Table[f@n, {n, 2, 32}] (* _Robert G. Wilson v_, Jul 11 2009 *)
%t Table[d=Divisors[n!]; len=Length[d]; If[OddQ[len], 0, d[[1 + len/2]] - d[[len/2]]], {n, 34}] (* _Vincenzo Librandi_, Jan 02 2016 *)
%o (PARI) for(k=2,25,d=divisors(k!);print(d[#d/2+1]-d[#d/2])) \\ _Jaume Oliver Lafont_, Mar 13 2009
%o (Python)
%o from math import isqrt, factorial
%o from sympy import divisors
%o def A061057(n):
%o k = factorial(n)
%o m = max(d for d in divisors(k,generator=True) if d <= isqrt(k))
%o return k//m-m # _Chai Wah Wu_, Apr 06 2022
%Y Cf. A000142, A060776, A060777, A060795, A060796, A061060, A061030, A061031, A061032, A061033, A005563, A038507, A038667, A056737, A146968.
%K nonn
%O 1,4
%A _Ed Pegg Jr_, May 28 2001
%E More terms from _Dean Hickerson_, Jun 13 2001
%E Edited by _N. J. A. Sloane_ Jul 07 2009 at the suggestion of _R. J. Mathar_ and _Alois P. Heinz_
%E a(41) from _Robert G. Wilson v_, Oct 03 2014