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.
n = 8: q(8) = 2*3*5*7*11*13*17*19 = 9699690. Its 128th and 129th divisors are {3094, 3135}: a(8) = 3094 and 3094 < A000196(9699690) = 3114 < 3135. [Corrected by _Colin Barker_, Oct 22 2010] 2*3*5*7 = 210 = 14*15 with difference of 1, so a(4) = 14.
F:= proc(n) local P,N,M; P:= {seq(ithprime(i),i=1..n)}; N:= floor(sqrt(convert(P,`*`))); M:= map(convert, combinat:-powerset(P),`*`); max(select(`<=`,M,N)) end proc: map(F, [$1..20]); # Robert Israel, Feb 22 2016
a[n_] := (m = Times @@ Prime[Range[n]] ; dd = Divisors[m]; dd[[Length[dd]/2 // Floor]]); Table[Print[an = a[n]]; an, {n, 1, 25}] (* Jean-François Alcover, Oct 15 2016 *)
a(n) = my(m=prod(i=1, n, prime(i))); divisors(m)[numdiv(m)\2]; \\ Michel Marcus, Feb 22 2016
For n = 6, 6! = 720 = 8*9*10, so x=8, y=9, z=10.
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.
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 (mmbb 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])); ll[n]/ g(1, nops(l), 1) end: seq(a(n), n=1..23); # Alois P. Heinz, Nov 22 2011
a[n_] := a[n] = Module[{s, t}, {s, t} = MinimalBy[{#, Complement[Range[n], #]}& /@ Subsets[Range[n]], Abs[Times @@ #[[1]] - Times @@ #[[2]]]&][[1]]; Max[Times @@ s, Times @@ t]]; Table[Print[n, " ", a[n]]; a[n], {n, 1, 25}] (* Jean-François Alcover, Nov 07 2020 *)
from math import prod, factorial from itertools import combinations def A200744(n): m = factorial(n) return min((abs((p:=prod(d))-m//p),max(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
2! = 1*2, with difference of 1. 3! = 2*3, with difference of 1. 4! = 4*6, with difference of 2. 5! = 10*12, with difference of 2. 6! = 24*30, with difference of 6. 7! = 70*72 with difference of 2. The corresponding central divisors are two units apart (equivalently, n!+1=A038507(n) is a square) for n = 4, 5, 7 (see A146968).
A060777 := proc(n) local d,nd ; d := sort(convert(numtheory[divisors](n!),list)) ; nd := nops(d) ; op(floor(1+nd/2),d) ; end: A060776 := proc(n) local d,nd ; d := sort(convert(numtheory[divisors](n!),list)) ; nd := nops(d) ; op(floor(nd/2),d) ; end: A061057 := proc(n) A060777(n)-A060776(n) ; end: seq(A061057(n),n=2..27) ; # R. J. Mathar, Mar 14 2009
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} ] 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 *) 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 *)
for(k=2,25,d=divisors(k!);print(d[#d/2+1]-d[#d/2])) \\ Jaume Oliver Lafont, Mar 13 2009
from math import isqrt, factorial from sympy import divisors def A061057(n): k = factorial(n) m = max(d for d in divisors(k,generator=True) if d <= isqrt(k)) return k//m-m # Chai Wah Wu, Apr 06 2022
a(4)=1: 2*3*5*7 = 210 = 14*15, so we can take x=14, y=15, with difference of 1. Also: n=3: 2*3-5=1; n=4: 3*5-2*7=1; n=5: 5*11-2*3*7=13; n=6: 2*7*13-3*5*11=17; n=7: 5*11*13-2*3*7*17=1; n=8: 3*5*11*19-2*7*13*17=41
A061060aux := proc(l1,l2) local resul ; resul := product(l1[i],i=1..nops(l1)) ; resul := resul-product(l2[i],i=1..nops(l2)) ; RETURN(abs(resul)) ; end: A061060 := proc(n) local plist,i,subl,resul,j,l1,l2,k,d ; plist := [] ; resul := 1 ; for i from 1 to n do resul := resul*ithprime(i) ; plist := [op(plist), ithprime(i)] ; od; for i from 1 to n/2 do subl := combinat[choose](plist,i) ; for j from 1 to nops(subl) do l1 := op(j,subl) ; l2 := convert(plist,set) minus convert(l1,set) ; d := A061060aux(l1,l2) ; if d < resul then resul := d ; fi ; od; od ; RETURN(resul) ; end: for n from 3 to 19 do printf("%d,",A061060(n)) ; od ; # R. J. Mathar, Aug 26 2006 [This Maple program was attached to A121315. However I think it belongs here, so I renamed the variables and moved it to this entry. - N. J. A. Sloane, Sep 16 2005]
(* first do *) Needs["DiscreteMath`Combinatorica`"] (* then *) f[n_] := Block[{arrayofnprimes = Array[Prime, n], primorial = Times @@ Array[Prime, n], diffmin = Infinity, adiff, sub}, If[n == 1, 1, Do[sub = Times @@ NthSubset[i, arrayofnprimes]; adiff = Abs[primorial/sub - sub]; If[adiff < diffmin, diffmin = adiff], {i, 2, 2^n/2}]; diffmin]]; Do[ Print@f@n, {n, 30}] (* Robert G. Wilson v, Sep 14 2006 *)
a(3) = 11 = min{ 2*3 + 5 = 11, 2*5 + 3 = 13, 3*5 + 2 = 17 } Or, a(3) = 11 = min { 1+30, 2+15, 3+10, 5+6 } because A002110(3) = 2*3*5 = 30 = 2*15 = 3*10 = 5*6.
a[0] = 2; a[n_] := Module[{m = Times @@ Prime[Range[n]]}, For[an = 2 Floor[Sqrt[m]] + 1, an <= m + 2, an += 2, If[IntegerQ[Sqrt[an^2 - 4 m]], Return[an]]]]; Table[an = a[n]; Print[an]; an, {n, 0, 25}] (* Jean-François Alcover, Oct 20 2016, adapted from PARI *)
A182987(n)={if(n,vecsum(divisors(vecprod(primes(n)))[2^(n-1)..2^(n-1)+1]),2)} \\ Needs stack size >= 2^(n+6). - M. F. Hasler, Sep 20 2011, edited Mar 24 2022
A182987(n)={ n||return(2); my(m=prod(k=1,n,prime(k))); forstep(a=2*sqrtint(m)+1,m+2,2, issquare(a^2-4*m) & return(a)) } \\ Slow for n >= 28, but needs not much memory. - M. F. Hasler, following an idea from David Broadhurst, Sep 20 2011
def A182987(n): # becomes slow for n >= 28, but not slower than memory-hungry # sum(divisors(primorial(n))[2**(n-1)-1:2**(n-1)+1]) if n else 2 "Compute A182987(n) = sum of the two central divisors of primorial(n)." if n < 2: return n+2 from math import isqrt # = A000196 from sympy import primorial # = A002110 from sympy.ntheory.primetest import is_square # = A010052 m = primorial(n)*4; a = isqrt(m)|1 ### ceil(sqrt(m))**2 < m for n = 26..27 !! while True: if is_square(a*a - m): return a a += 2 # M. F. Hasler, Mar 21 2022
Comments