login
a(0) = 0; for n > 0, a(n) is the smallest positive number not occurring earlier such that |a(n) - a(n-1)| does not appear in the string concatenation of a(0)..a(n-1).
2

%I #12 Jan 16 2023 09:10:46

%S 0,1,3,5,7,9,11,13,15,17,19,21,25,2,6,10,14,22,4,12,20,28,44,8,24,40,

%T 56,18,34,50,23,39,55,26,42,58,29,45,61,31,47,63,27,43,59,75,37,53,69,

%U 85,36,52,68,30,46,62,78,94,110,33,49,65,81,97,113,41,57,73,35,51,67,105,143,16,54

%N a(0) = 0; for n > 0, a(n) is the smallest positive number not occurring earlier such that |a(n) - a(n-1)| does not appear in the string concatenation of a(0)..a(n-1).

%C The sequence is conjectured to be a permutation of the positive integers. In the first 200000 terms the only fixed points are 20, 24, 43 and 115. It is likely no more exist although this is unknown.

%C There are no other fixed points in the first 870000 terms. - _Michael S. Branicky_, Oct 05 2022

%H Scott R. Shannon, <a href="/A357377/a357377.png">Image for n=0..200000</a>. The green line is a(n) = n.

%e a(12) = 25 as the concatenation of a(0)..a(11) is "013579111315171921" and |25 - a(11)| = |25 - 21| = 4 which does not appear in the concatenated string. Since a(11) contains a '2' and all other odd numbers appear in the string a(12) cannot be 23 or any even number less than 25.

%e a(13) = 2 as the concatenation of a(0)..a(12) is "01357911131517192125" and |2 - a(12)| = |2 - 25| = 23 which does not appear in the concatenated string.

%o (Python)

%o from itertools import count, islice

%o def agen(): # generator of terms

%o alst, aset, astr, an, mink, mindiff = [], set(), "", 0, 1, 1

%o for n in count(0):

%o yield an; aset.add(an); astr += str(an)

%o prevan, an = an, mink

%o while an + mindiff <= prevan and (an in aset or str(abs(an-prevan)) in astr): an += 1

%o if an in aset or str(abs(an-prevan)) in astr:

%o an = max(mink, prevan + mindiff)

%o while an in aset or str(an-prevan) in astr:

%o an += 1

%o while mink in aset: mink += 1

%o while str(mindiff) in astr: mindiff += 1

%o print(list(islice(agen(), 75))) # _Michael S. Branicky_, Oct 05 2022

%Y Cf. A355611 (base 2), A357082, A007088, A030302, A118248, A341766.

%K nonn,base,look

%O 0,3

%A _Scott R. Shannon_, Sep 26 2022