login
a(n) = A005282(n) - A011185(n-1).
3

%I #12 Sep 11 2023 17:51:49

%S 0,0,1,3,5,8,10,15,27,28,23,28,20,30,22,40,32,45,27,62,89,62,116,167,

%T 105,118,108,51,99,151,88,137,137,265,174,195,320,321,249,283,226,281,

%U 293,394,465,369,585,565,639,404,483,221,233,428,384,370,527,431,818

%N a(n) = A005282(n) - A011185(n-1).

%C Also A025582(n) - A010672(n-1).

%C A005282 is the sequence of smallest numbers such that the pairwise sums of not necessarily distinct elements are all distinct, whereas A011185 is the sequence of smallest numbers such that the pairwise sums of distinct elements are all distinct.

%C Sequence has negative terms; the first one is a(65) = -130.

%H Klaus Brockhaus, <a href="/A133097/b133097.txt">Table of n, a(n) for n = 1..2400</a>

%e a(6) = A005282(6) - A011185(6) = 21 - 13 = 8.

%o (Python)

%o from itertools import count, islice

%o from collections import deque

%o def A133097_gen(): # generator of terms

%o aset2, alist, bset2, blist, aqueue, bqueue = set(), [], set(), [], deque(), deque()

%o for k in count(1):

%o cset2 = {k<<1}

%o if (k<<1) not in aset2:

%o for a in alist:

%o if (m:=a+k) in aset2:

%o break

%o cset2.add(m)

%o else:

%o aqueue.append(k)

%o alist.append(k)

%o aset2.update(cset2)

%o cset2 = set()

%o for b in blist:

%o if (m:=b+k) in bset2:

%o break

%o cset2.add(m)

%o else:

%o bqueue.append(k)

%o blist.append(k)

%o bset2.update(cset2)

%o if len(aqueue) > 0 and len(bqueue) > 0:

%o yield aqueue.popleft()-bqueue.popleft()

%o A133097_list = list(islice(A133097_gen(),30)) # _Chai Wah Wu_, Sep 11 2023

%Y Cf. A005282, A011185, A025582, A010672, A133096.

%K sign

%O 1,4

%A _Klaus Brockhaus_, Sep 17 2007