%I #52 Mar 18 2024 07:33:47
%S 0,1,3,7,12,20,30,44,65,80,96,122,147,181,203,251,289,360,400,474,564,
%T 592,661,774,821,915,969,1015,1158,1311,1394,1522,1571,1820,1895,2028,
%U 2253,2378,2509,2779,2924,3154,3353,3590,3796,3997,4296,4432,4778,4850
%N A B_2 sequence: a(n) is the least value such that sequence increases and pairwise sums of elements are all distinct.
%C a(n) is also the least value such that sequence increases and pairwise differences of distinct elements are all distinct.
%H David W. Wilson, <a href="/A025582/b025582.txt">Table of n, a(n) for n = 1..1000</a>
%H Alon Amit, <a href="https://www.quora.com/What-are-some-interesting-proofs-using-transfinite-induction/answer/Alon-Amit">What are some interesting proofs using transfinite induction?</a>, Quora, Nov 15 2014.
%H LiJun Zhang, Bing Li, and LeeTang Cheng, <a href="http://dx.doi.org/10.1007/s11432-013-4971-x">Constructions of QC LDPC codes based on integer sequences</a>, Science China Information Sciences, June 2014, Volume 57, Issue 6, pp 1-14.
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/B2-Sequence.html">B2 Sequence</a>.
%H <a href="/index/Br#B_2">Index entries for B_2 sequences.</a>
%F a(n) = A005282(n) - 1. - _Tyler Busby_, Mar 16 2024
%e After 0, 1, a(3) cannot be 2 because 2+0 = 1+1, so a(3) = 3.
%o (Sage)
%o def A025582_list(n):
%o a = [0]
%o psums = set([0])
%o while len(a) < n:
%o a += [next(k for k in IntegerRange(a[-1]+1, infinity) if not any(i+k in psums for i in a+[k]))]
%o psums.update(set(i+a[-1] for i in a))
%o return a[:n]
%o print(A025582_list(20))
%o # _D. S. McNeil_, Feb 20 2011
%o (Python)
%o from itertools import count, islice
%o def A025582_gen(): # generator of terms
%o aset1, aset2, alist = set(), set(), []
%o for k in count(0):
%o bset2 = {k<<1}
%o if (k<<1) not in aset2:
%o for d in aset1:
%o if (m:=d+k) in aset2:
%o break
%o bset2.add(m)
%o else:
%o yield k
%o alist.append(k)
%o aset1.add(k)
%o aset2 |= bset2
%o A025582_list = list(islice(A025582_gen(),20)) # _Chai Wah Wu_, Sep 01 2023
%Y Row 2 of A365515.
%Y See A011185 for more information.
%Y A010672 is a similar sequence, but there the pairwise sums of distinct elements are all distinct.
%K nonn
%O 1,3
%A _Dan Hoey_