|
|
A357377
|
|
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
|
|
|
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, 56, 18, 34, 50, 23, 39, 55, 26, 42, 58, 29, 45, 61, 31, 47, 63, 27, 43, 59, 75, 37, 53, 69, 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
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
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.
|
|
LINKS
|
|
|
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
|
|
CROSSREFS
|
|
|
KEYWORD
|
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|