login
A087053
Numbers of the form pq + qr + rp where p, q and r are distinct primes, with multiplicity.
7
31, 41, 61, 59, 71, 91, 71, 87, 101, 101, 121, 113, 103, 129, 151, 131, 161, 143, 119, 191, 171, 131, 167, 211, 151, 221, 185, 151, 241, 167, 191, 213, 227, 271, 221, 199, 301, 191, 311, 269, 243, 167, 211, 341, 275, 297, 269, 361, 215, 311, 293, 247, 371
OFFSET
1,1
COMMENTS
Arithmetic derivative of numbers having exactly three primes that are distinct: a(n) = A003415(A007304(n)).
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
Sequence in context: A245650 A363187 A098711 * A159045 A099181 A040989
KEYWORD
nonn
AUTHOR
Reinhard Zumkeller, Aug 07 2003
STATUS
approved