cp's OEIS Frontend

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.

A101274 a(1)=1; for n>1, a(n) is the smallest positive integer such that the set of all sums of adjacent elements up to and including a(n) contains no number more than once.

This page as a plain text file.
%I A101274 #24 Sep 05 2023 18:39:54
%S A101274 1,2,4,5,8,10,14,21,15,16,26,25,34,22,48,38,71,40,74,90,28,69,113,47,
%T A101274 94,54,46,143,153,83,128,49,249,75,133,225,125,131,270,145,230,199,
%U A101274 237,206,201,299,136,346,72,272,120,55,453,247,376,427,124,535,87,242,431,283,227,212,940,318,387,311,391,325
%N A101274 a(1)=1; for n>1, a(n) is the smallest positive integer such that the set of all sums of adjacent elements up to and including a(n) contains no number more than once.
%C A101274 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.
%C A101274 The first differences of A005282. [_Zak Seidov_, Nov 06 2010]
%H A101274 Jean-Marc Falcoz, <a href="/A101274/b101274.txt">Table of n, a(n) for n = 1..483</a>
%H A101274 E. Giaquinta and S. Grabowski, <a href="http://arxiv.org/abs/1210.6176">New algorithms for binary jumbled pattern matching</a>, arXiv preprint arXiv:1210.6176 [cs.DS], 2012. - From _N. J. A. Sloane_, Jan 01 2013
%e A101274 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}.
%e A101274 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.
%t A101274 t = {1}; sms = {2}; k = 1;
%t A101274 Do[k++; While[Intersection[sms, k + t] != {}, k++]; sms = Join[sms, t + k, {2 k}]; AppendTo[t, k], {41}];
%t A101274 Differences[t] (* _Jean-François Alcover_, Feb 13 2019, after _T. D. Noe_ in A005282 *)
%o A101274 (Python)
%o A101274 from itertools import count, islice
%o A101274 def A101274_gen(): # generator of terms
%o A101274     aset1, aset2, alist, n = {1}, set(), [1], 1
%o A101274     for k in count(2):
%o A101274         bset2 = {k<<1}
%o A101274         if (k<<1) not in aset2:
%o A101274             for d in aset1:
%o A101274                 if (m:=d+k) in aset2:
%o A101274                     break
%o A101274                 bset2.add(m)
%o A101274             else:
%o A101274                 yield k-n
%o A101274                 n = k
%o A101274                 alist.append(k)
%o A101274                 aset1.add(k)
%o A101274                 aset2.update(bset2)
%o A101274 A101274_list = list(islice(A101274_gen(),30)) # _Chai Wah Wu_, Sep 05 2023
%Y A101274 Cf. A005282.
%K A101274 nonn
%O A101274 1,2
%A A101274 _David S. Newman_, Dec 20 2004