OFFSET
1,2
COMMENTS
Does the sequence together with the sums of adjacent elements include all positive integers? Choosing starting values other than a(1)=1 gives other sequences. We could ask, for a given n, which such sequences have the smallest sum of a(k) from k=1 to n.
The first differences of A005282. [Zak Seidov, Nov 06 2010]
LINKS
Jean-Marc Falcoz, Table of n, a(n) for n = 1..483
E. Giaquinta and S. Grabowski, New algorithms for binary jumbled pattern matching, arXiv preprint arXiv:1210.6176 [cs.DS], 2012. - From N. J. A. Sloane, Jan 01 2013
EXAMPLE
a(8)=21 because the set of sums of adjacent elements to this point, call it s(7) is {1,2,3,4,5,6,7,8,9,10,11,12,13,14,17,18,19,20,23,24,27,29,30,32,37,41,43,44}.
The first number missing from this list is 15, but a(8) cannot equal 15 because 15+14=29 and 29 is already in s(7). Similarly a(8) cannot be 16 because 16+14=30.
MATHEMATICA
t = {1}; sms = {2}; k = 1;
Do[k++; While[Intersection[sms, k + t] != {}, k++]; sms = Join[sms, t + k, {2 k}]; AppendTo[t, k], {41}];
PROG
(Python)
from itertools import count, islice
def A101274_gen(): # generator of terms
aset1, aset2, alist, n = {1}, set(), [1], 1
for k in count(2):
bset2 = {k<<1}
if (k<<1) not in aset2:
for d in aset1:
if (m:=d+k) in aset2:
break
bset2.add(m)
else:
yield k-n
n = k
alist.append(k)
aset1.add(k)
aset2.update(bset2)
CROSSREFS
KEYWORD
nonn
AUTHOR
David S. Newman, Dec 20 2004
STATUS
approved