This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A010672 #39 Jan 14 2025 23:10:22 %S A010672 0,1,2,4,7,12,20,29,38,52,73,94,127,151,181,211,257,315,373,412,475, %T A010672 530,545,607,716,797,861,964,1059,1160,1306,1385,1434,1555,1721,1833, %U A010672 1933,2057,2260,2496,2698,2873,3060,3196,3331,3628,3711,3867,4139,4446,4639 %N A010672 A B_2 sequence: a(n) = least value such that the sequence increases and pairwise sums of distinct terms are all distinct. %H A010672 Giovanni Resta, <a href="/A010672/b010672.txt">Table of n, a(n) for n = 0..10000</a> (first 7611 terms from D. Mondot) %H A010672 <a href="/index/Br#B_2">Index entries for B_2 sequences</a>. %F A010672 a(n) = A011185(n+1) - 1. - _Robert Israel_, May 02 2016 %p A010672 N:= 10^6: # to get all terms <= N %p A010672 A[0]:= 0: Delta:= {}: As:= {A[0]}: %p A010672 Cands:= {$1..N}: %p A010672 for n from 1 while Cands <> {} do %p A010672 A[n]:= min(Cands); %p A010672 Cands:= Cands minus ({A[n]} union map(`+`,Delta, A[n])); %p A010672 Delta:= Delta union map(t ->A[n] - t, As); %p A010672 As:= As union {A[n]}; %p A010672 od: %p A010672 seq(A[i],i=0..n-1); # _Robert Israel_, May 02 2016 %t A010672 seq = {0}; %t A010672 pairSums = {}; %t A010672 nextTerm = 1; %t A010672 pairSumsUpdate := Join[pairSums, nextTerm + seq] %t A010672 hasDuplicates := ! DuplicateFreeQ[pairSumsUpdate] %t A010672 Do[ %t A010672 While[hasDuplicates, nextTerm++]; %t A010672 pairSums = pairSumsUpdate; %t A010672 AppendTo[seq, nextTerm]; %t A010672 , 50] %t A010672 seq (* _David Trimas_, Dec 28 2024 *) %o A010672 (MATLAB) %o A010672 N = 3*10^8; % to get all terms < N %o A010672 Cands = ones(N,1); %o A010672 Delta = []; %o A010672 A = []; %o A010672 n = 1; %o A010672 while nnz(Cands) > 0 %o A010672 A(n) = find(Cands,1,'first'); %o A010672 Cands(A(n)) = 0; %o A010672 Rem = Delta(Delta <= N - A(n)) + A(n); %o A010672 Cands(Rem) = 0; %o A010672 Delta = union(Delta, -A(1:n-1)+A(n)); %o A010672 if mod(n,10)==0 %o A010672 fprintf('a(%d)=%d\n',n,A(n)); %o A010672 toc; %o A010672 end %o A010672 n = n + 1; %o A010672 end %o A010672 A - 1 % _Robert Israel_, May 02 2016 %o A010672 (Python) %o A010672 from itertools import count, islice %o A010672 def A010672_gen(): # generator of terms %o A010672 aset2, alist = set(), [] %o A010672 for k in count(0): %o A010672 bset2 = set() %o A010672 for a in alist: %o A010672 if (b:=a+k) in aset2: %o A010672 break %o A010672 bset2.add(b) %o A010672 else: %o A010672 yield k %o A010672 alist.append(k) %o A010672 aset2.update(bset2) %o A010672 A010672_list = list(islice(A010672_gen(),30)) # _Chai Wah Wu_, Sep 11 2023 %Y A010672 A025582 is a similar sequence, but there the pairwise sums of (not necessarily distinct) elements are all distinct. %Y A010672 Cf. A011185. %K A010672 nonn %O A010672 0,3 %A A010672 _Dan Hoey_