%I #17 Feb 08 2024 09:46:24
%S 1,10,98,767,111,122,2,11,100,889,110,4490,400,560,1096,124,20,129,70,
%T 502,93,171,212,361,512,26,21,36,54,14,1011,139,99,59,550,684,345,102,
%U 1021,1999,2871,137,892,89,126,875,510,994,586,2012,662,1836,201,405,388,2007,2798,1641,50,340
%N Lexicographically earliest sequence of distinct positive integers such that the sum of all terms a(1)..a(n) is a substring of the concatenation of all terms a(1)..a(n).
%C In the first 10000 terms the smallest number that has not yet appeared is 696; it is therefore likely all numbers eventually appear although this is unknown.
%H Scott R. Shannon, <a href="/A363186/b363186.txt">Table of n, a(n) for n = 1..10000</a>
%H Eric Angelini, <a href="http://cinquantesignes.blogspot.com/2023/07/echecs-et-maths.html">Échecs et Maths</a>, Personal blog, July 2023.
%e a(2) = 10 as a(1) + 10 = 1 + 10 = 11 which is a substring of "1" + "10" = "110".
%e a(3) = 98 as a(1) + a(2) + 98 = 1 + 10 + 98 = 109 which is a substring of "1" + "10" + "98" = "11098".
%e a(4) = 767 as a(1) + a(2) + a(3) + 767 = 1 + 10 + 98 + 767 = 876 which is a substring of "1" + "10" + "98" + "767" = "11098767".
%o (Python)
%o from itertools import islice
%o def agen(): # generator of terms
%o s, mink, aset, concat = 1, 2, {1}, "1"
%o yield from [1]
%o while True:
%o an = mink
%o while an in aset or not str(s+an) in concat+str(an): an += 1
%o aset.add(an); s += an; concat += str(an); yield an
%o while mink in aset: mink += 1
%o print(list(islice(agen(), 60))) # _Michael S. Branicky_, Feb 08 2024
%Y Cf. A359482, A300000, A339144, A357082.
%K nonn,base
%O 1,2
%A _Scott R. Shannon_ and _Eric Angelini_, Jul 07 2023
|