OFFSET
1,7
COMMENTS
LINKS
Klaus Brockhaus, Table of n, a(n) for n = 1..4944
PROG
(Python)
from collections import deque
from itertools import count, islice
def A133744_gen(): # generator of terms
aset2, alist, bset2, blist, aqueue, bqueue = set(), [], set(), [], deque(), deque()
for k in (n**2 for n in count(1)):
cset2 = {k<<1}
if (k<<1) not in aset2:
for a in alist:
if (m:=a+k) 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 24 2007
STATUS
approved