login
A360521
a(0) = 0; for n > 0, a(n) is the smallest positive number not occurring earlier such that neither the binary string a(n-1) + a(n) nor the same string reversed appear in the binary string concatenation of a(0)..a(n-1).
1
0, 1, 2, 3, 4, 5, 10, 6, 9, 7, 17, 15, 18, 14, 19, 13, 20, 12, 21, 11, 22, 26, 8, 24, 27, 37, 28, 23, 25, 39, 29, 35, 30, 34, 31, 33, 32, 36, 41, 44, 43, 42, 38, 62, 57, 70, 58, 69, 59, 68, 60, 67, 61, 66, 63, 64, 65, 71, 76, 52, 84, 72, 56, 80, 48, 88, 40, 96, 51, 77, 83, 45, 91, 81, 47, 89, 86
OFFSET
0,3
COMMENTS
As in A357082 the main concentration of terms is along the line a(n) = n, so there are numerous fixed points - there are 24 fixed points in the first 200000 terms. The sequence is conjectured to be a permutation of the positive integers.
Note that when the binary string of a(n-1) + a(n) is reversed any resulting leading 0's are retained for the string comparison.
LINKS
Scott R. Shannon, Image for n=0..60000.
Scott R. Shannon, Image for n=0..200000. The tip of the large right-pointing 'arrow' corresponds to the term a(159580) = 131072 = 100000000000000000_2.
Scott R. Shannon, Image for n=0..600000.
Scott R. Shannon, Image of first million terms.
Scott R. Shannon and Zach J. Shannon, Image of first ten million terms. This is a high resolution image so zoom in to see the details.
Scott R. Shannon and Zach J. Shannon, Image of first thirty six million terms. This is a high resolution image so zoom in to see the details.
EXAMPLE
a(11) = 15 as the concatenation of a(0)..a(10) in binary is "0110111001011010110100111110001" and a(10) + 15 = 17 + 15 = 32 = 100000_2 which does not appear in the concatenated string, nor does its reverse "000001". Although 17 + 12 = 29 = 11101_2 does not appear in the string its reverse "10111" does, so a(11) cannot be 12. This is the first term to differ from A357082.
MATHEMATICA
nn = 76; c[_] = False; j = a[0] = 0; u = 1; w = "0"; Do[k = u; While[Or[c[k], StringContainsQ[w, Set[v, IntegerString[j + k, 2]]], StringContainsQ[w, StringReverse[v]]], k++]; Set[{a[n], c[k]}, {k, True}]; Set[{j, w}, {k, w <> IntegerString[k, 2]}]; If[k == u, While[c[u], u++]], {n, nn}]; Array[a, nn + 1, 0] (* Michael De Vlieger, Feb 15 2023 *)
PROG
(Python)
from itertools import islice
def agen(): # generator of terms
an, astr, aset, mink = 0, "", set(), 1
while True:
yield an
s = bin(an)[2:]
astr += s
k = mink
while k in aset or (t:=bin(an+k)[2:]) in astr or t[::-1] in astr:
k += 1
an = k
aset.add(an)
while mink in aset: mink += 1
print(list(islice(agen(), 80))) # Michael S. Branicky, Feb 10 2023
CROSSREFS
KEYWORD
nonn,look,base,nice,changed
AUTHOR
Scott R. Shannon, Feb 09 2023
STATUS
approved