OFFSET
1,1
COMMENTS
PROG
(PARI) is(n)=forprime(r=(sqrtint(3*n-3)+5)\3, (n-6)\5, forprime(q= sqrtint(r^2+n)-r+1, min((n-2*r)\(r+2), r-2), if((n-q*r)%(q+r)==0 && isprime((n-q*r)/(q+r)), return(1)))); 0 \\ Charles R Greathouse IV, Feb 26 2014
(PARI) list(n)=my(v=List()); forprime(r=5, (n-6)\5, forprime(q=3, min((n-2*r)\(r+2), r-2), my(S=q+r, P=q*r); forprime(p=2, min((n-P)\S, q-1), listput(v, p*S+P)))); Set(v) \\ Charles R Greathouse IV, Feb 26 2014
(Python)
from math import isqrt
from sympy import primepi, primerange, integer_nthroot, primefactors
def A087053(n):
def f(x): return int(n+x-sum(primepi(x//(k*m))-b for a, k in enumerate(primerange(integer_nthroot(x, 3)[0]+1), 1) for b, m in enumerate(primerange(k+1, isqrt(x//k)+1), a+1)))
def bisection(f, kmin=0, kmax=1):
while f(kmax) > kmax: kmax <<= 1
while kmax-kmin > 1:
kmid = kmax+kmin>>1
if f(kmid) <= kmid:
kmax = kmid
else:
kmin = kmid
return kmax
return (p:=primefactors(bisection(f)))[0]*(p[1]+p[2])+p[1]*p[2] # Chai Wah Wu, Aug 30 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
Reinhard Zumkeller, Aug 07 2003
STATUS
approved