OFFSET
0,4
COMMENTS
The longest run of 0 terms, corresponding to binary values that have not previously appeared, for n up to 100000 is four, starting at n = 512. Not all powers of 2 are 0 as it may have appeared as a previous value's offset, e.g., a(65536) = 412323.
LINKS
Scott R. Shannon, Image of the first 100000 terms.
EXAMPLE
a(1) = 1 as the binary string concatenation up to a(0) = '1', and the binary value of 1 is '1' which appears 1 (1_2) digit back from the end of the string.
a(2) = 0 as the binary string concatenation up to a(1) = '11', while the binary value of 2 is '10' which does not appear in the string.
a(3) = 3 as the binary string concatenation up to a(2) = '110', and the binary value of 3 is '11' which appears 3 (11_2) digits back from the end of the string.
a(5) = 5 as the binary string concatenation up to a(4) = '110110', and the binary value of 5 is '101' which appears 5 (101_2) digits back from the end of the string.
a(10) = 7 as the binary string concatenation up to a(9) = '11011010111010000', and the binary value of 10 is '1010' which appears 7 (111_2) digits back from the end of the string.
PROG
(Python)
from itertools import count, islice
def agen():
b = "1"
yield 1
for k in count(1):
bk = bin(k)[2:]
idx = b.rfind(bk)
if idx == -1:
yield 0
b += "0"
else:
yield len(b) - idx
b += bin(len(b) - idx)[2:]
print(list(islice(agen(), 79))) # Michael S. Branicky, Mar 18 2022
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Scott R. Shannon, Mar 07 2021
STATUS
approved