A355611 a(0) = 0; for n > 0, a(n) is the smallest positive number not occurring earlier such that the binary string of |a(n) - a(n-1)| does not appear in the binary string concatenation of a(0)..a(n-1).
0, 1, 3, 5, 9, 17, 7, 23, 2, 12, 22, 6, 16, 37, 58, 10, 38, 4, 32, 60, 14, 48, 82, 8, 42, 85, 15, 61, 107, 11, 67, 131, 18, 86, 13, 77, 141, 21, 89, 25, 93, 20, 84, 148, 19, 83, 147, 27, 91, 155, 26, 90, 154, 24, 88, 152, 28, 92, 156, 36, 100, 164, 30, 94, 158, 29, 142, 78, 191, 31, 95, 159
Offset: 0
Examples
a(5) = 17 as the concatenation of a(0)..a(4) in binary is "01111011001" and |17 - a(4)| = |17 - 9| = 8 = 1000_2 which does not appear in the concatenated string. Since 1 = 1_2, 2 = 10_2, 3 = 11_2, 4 = 100_2, 5 = 101_2, 6 = 110_2, 7 = 111_2 all appear in the concatenated string, a(5) cannot be less than 17.
Links
- Scott R. Shannon, Image of n=0..200000. The green line is a(n) = n.
Programs
-
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 += bin(an)[2:] prevan, an = an, mink while an + mindiff <= prevan and (an in aset or bin(abs(an-prevan))[2:] in astr): an += 1 if an in aset or bin(abs(an-prevan))[2:] in astr: an = max(mink, prevan + mindiff) while an in aset or bin(an-prevan)[2:] in astr: an += 1 while mink in aset: mink += 1 while bin(mindiff)[2:] in astr: mindiff += 1 print(list(islice(agen(), 72))) # Michael S. Branicky, Oct 05 2022
Comments