%I #87 Jan 22 2024 06:19:50
%S 2,3,5,11,29,97,347,1429,6229,29873,160879,895681,5448239,34885673,
%T 228759799,1568299433,11417382973,87698582693,684947829299,
%U 5606539600699,47241542381273,403631914511993,3587558929043927,32684217334524347,308342289648328511,3036819365023723883
%N Least a + b such that a*b = A002110(n), the product of the first n primes, where a, b are positive integers.
%C Original definition (not applicable for n = 0 and 1, but equivalent for n >= 2):
%C Let p(S) be product of integers in S. a(n) is minimum of p(S_1) + p(S_2) over all partitions of first n primes into sets S_1 and S_2.
%C Also: Least integer such that a(n)^2 - 4*A002110(n) is a square. - _David Broadhurst_, Sep 20 2011
%C The integers a,b are the two median divisors of primorial(n), a = A060795(n) = A060775(A002110(n)) and b = A060796(n) = A033677(A002110(n)). (For n = 0, a = b = 1 of course.) - _M. F. Hasler_, Sep 20 2011
%H Max Alekseyev, <a href="/A182987/b182987.txt">Table of n, a(n) for n = 0..70</a>
%H David Broadhurst, <a href="http://groups.yahoo.com/group/primenumbers/message/23128">Re: adding to prime number [primes in A182987]</a>, primenumbers group, Sep 20 2011.
%H David Broadhurst and others, <a href="/A182987/a182987.txt">Adding to prime number</a>, digest of 28 messages in primenumbers Yahoo group, Sep 19, 2011 - Sep 22, 2011.
%F a(n) = A060795(n) + A060796(n). - _M. F. Hasler_, Sep 20 2011
%F Conjecture: Limit_{N->oo} (Sum_{n=1..N} log(a(n)-2*sqrt(prime(n)#))) / (Sum_{n=1..N} prime(n)) = 2/e - 1/2 (i.e., A135002 - 1/2). - _Alain Rocchelli_, Nov 30 2023
%e a(3) = 11 = min{ 2*3 + 5 = 11, 2*5 + 3 = 13, 3*5 + 2 = 17 }
%e 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.
%t 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 *)
%o (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
%o (PARI) 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
%o (Python)
%o def A182987(n): # becomes slow for n >= 28, but not slower than memory-hungry
%o # sum(divisors(primorial(n))[2**(n-1)-1:2**(n-1)+1]) if n else 2
%o "Compute A182987(n) = sum of the two central divisors of primorial(n)."
%o if n < 2: return n+2
%o from math import isqrt # = A000196
%o from sympy import primorial # = A002110
%o from sympy.ntheory.primetest import is_square # = A010052
%o m = primorial(n)*4; a = isqrt(m)|1 ### ceil(sqrt(m))**2 < m for n = 26..27 !!
%o while True:
%o if is_square(a*a - m): return a
%o a += 2
%o # _M. F. Hasler_, Mar 21 2022
%Y Cf. A173631, A060795, A060796, A061060, A127180.
%Y Cf. A000196 (integer sqrt), A002110 (primorial), A010052 (is_square).
%K nonn
%O 0,1
%A _Risto Kauppila_, Feb 06 2011
%E First term and example corrected, as empty sets have product 1, by _Phil Carmody_, Sep 20 2011
%E Simpler definition and extension to n = 0 by _M. F. Hasler_, Sep 20 2011
%E b-file extended to a(59) with results from R. Gerbicz (cf. 2nd Broadhurst link) by _M. F. Hasler_, Mar 22 2022
%E a(60)-a(70) in b-file from _Max Alekseyev_, Apr 20 2022