OFFSET
0,5
COMMENTS
This sequence is a variant of A030304.
When considering the binary reversal of a positive number, the trailing zeros in that number turn into leading zeros in its binary reversal; we keep those leading zeros.
LINKS
Rémy Sigrist, Table of n, a(n) for n = 0..8192
Rémy Sigrist, Perl program for A341798
EXAMPLE
For n = 4:
- the binary reversal of 4 is "001",
- the binary Champernowne word begins "0110111001011...",
- the first occurrence of "001" in this word starts at position 7,
- so a(4) = 7.
PROG
(Perl) See Links section.
(Python)
from itertools import count, islice
def agen():
k, chap = 0, "0"
for n in count(0):
target = bin(n)[2:][::-1]
while chap.find(target) == -1: k += 1; chap += bin(k)[2:]
yield chap.find(target)
print(list(islice(agen(), 70))) # Michael S. Branicky, Oct 06 2022
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Feb 20 2021
STATUS
approved