OFFSET
1,1
COMMENTS
From the first 795641 terms of A025487 (terms that are in range 1 .. 2^101) only 4238 (~ 0.5 %) are included in this sequence.
LINKS
Antti Karttunen, Table of n, a(n) for n = 1..4238
EXAMPLE
As A151800(512) = 521, with 521 - 512 = 9 (a composite number), 512 is included in this sequence.
PROG
(PARI)
isc(n) = ((n > 1)&&!isprime(n));
(Python)
from itertools import islice
from heapq import heappop, heappush
from sympy import nextprime, isprime, factorint, prevprime
def A329894_gen(): # generator of terms
h, hset = [1], {1}
while True:
m = heappop(h)
q = nextprime(m)
if q-m>1 and not isprime(q-m):
yield m
ps = factorint(m)
for p in ps:
if p == 2 or ps[prevprime(p)]>ps[p]:
mp = m*p
if mp not in hset:
heappush(h, mp)
hset.add(mp)
mp = m*nextprime(max(ps.keys(), default=1))
if mp not in hset:
heappush(h, mp)
hset.add(mp)
CROSSREFS
KEYWORD
nonn
AUTHOR
Antti Karttunen, Dec 24 2019
STATUS
approved
