login
A010672
A B_2 sequence: a(n) = least value such that the sequence increases and pairwise sums of distinct terms are all distinct.
9
0, 1, 2, 4, 7, 12, 20, 29, 38, 52, 73, 94, 127, 151, 181, 211, 257, 315, 373, 412, 475, 530, 545, 607, 716, 797, 861, 964, 1059, 1160, 1306, 1385, 1434, 1555, 1721, 1833, 1933, 2057, 2260, 2496, 2698, 2873, 3060, 3196, 3331, 3628, 3711, 3867, 4139, 4446, 4639
OFFSET
0,3
LINKS
Giovanni Resta, Table of n, a(n) for n = 0..10000 (first 7611 terms from D. Mondot)
FORMULA
a(n) = A011185(n+1) - 1. - Robert Israel, May 02 2016
MAPLE
N:= 10^6: # to get all terms <= N
A[0]:= 0: Delta:= {}: As:= {A[0]}:
Cands:= {$1..N}:
for n from 1 while Cands <> {} do
A[n]:= min(Cands);
Cands:= Cands minus ({A[n]} union map(`+`, Delta, A[n]));
Delta:= Delta union map(t ->A[n] - t, As);
As:= As union {A[n]};
od:
seq(A[i], i=0..n-1); # Robert Israel, May 02 2016
PROG
(MATLAB)
N = 3*10^8; % to get all terms < N
Cands = ones(N, 1);
Delta = [];
A = [];
n = 1;
while nnz(Cands) > 0
A(n) = find(Cands, 1, 'first');
Cands(A(n)) = 0;
Rem = Delta(Delta <= N - A(n)) + A(n);
Cands(Rem) = 0;
Delta = union(Delta, -A(1:n-1)+A(n));
if mod(n, 10)==0
fprintf('a(%d)=%d\n', n, A(n));
toc;
end
n = n + 1;
end
A - 1 % Robert Israel, May 02 2016
(Python)
from itertools import count, islice
def A010672_gen(): # generator of terms
aset2, alist = set(), []
for k in count(0):
bset2 = set()
for a in alist:
if (b:=a+k) in aset2:
break
bset2.add(b)
else:
yield k
alist.append(k)
aset2.update(bset2)
A010672_list = list(islice(A010672_gen(), 30)) # Chai Wah Wu, Sep 11 2023
CROSSREFS
A025582 is a similar sequence, but there the pairwise sums of (not necessarily distinct) elements are all distinct.
Cf. A011185.
Sequence in context: A125892 A072642 A105856 * A122515 A193840 A036372
KEYWORD
nonn
AUTHOR
STATUS
approved