OFFSET
0,3
COMMENTS
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.
There are no other fixed points in the first 870000 terms. - Michael S. Branicky, Oct 05 2022
LINKS
Scott R. Shannon, Image for n=0..200000. The green line is a(n) = n.
EXAMPLE
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.
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.
PROG
(Python)
from itertools import count, islice
def agen(): # generator of terms
alst, aset, astr, an, mink, mindiff = [], set(), "", 0, 1, 1
for n in count(0):
yield an; aset.add(an); astr += str(an)
prevan, an = an, mink
while an + mindiff <= prevan and (an in aset or str(abs(an-prevan)) in astr): an += 1
if an in aset or str(abs(an-prevan)) in astr:
an = max(mink, prevan + mindiff)
while an in aset or str(an-prevan) in astr:
an += 1
while mink in aset: mink += 1
while str(mindiff) in astr: mindiff += 1
print(list(islice(agen(), 75))) # Michael S. Branicky, Oct 05 2022
CROSSREFS
KEYWORD
AUTHOR
Scott R. Shannon, Sep 26 2022
STATUS
approved