OFFSET
1,4
COMMENTS
LINKS
Klaus Brockhaus, Table of n, a(n) for n = 1..3600
PROG
(Python)
from collections import deque
from itertools import islice
from sympy import nextprime
def A133096_gen(): # generator of terms
aset2, alist, bset2, blist, aqueue, bqueue, k = set(), [], set(), [], deque(), deque(), 1
while (k:=nextprime(k)):
cset2 = set()
for a in alist:
if (m:=k-a) in aset2:
break
cset2.add(m)
else:
aqueue.append(k)
alist.append(k)
aset2.update(cset2)
cset2 = set()
for b in blist:
if (m:=b+k) in bset2:
break
cset2.add(m)
else:
bqueue.append(k)
blist.append(k)
bset2.update(cset2)
if len(aqueue) > 0 and len(bqueue) > 0:
yield aqueue.popleft()-bqueue.popleft()
CROSSREFS
KEYWORD
sign
AUTHOR
Klaus Brockhaus, Sep 17 2007
STATUS
approved