cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A341798 a(n) is the starting position of the first occurrence of the binary reversal of n in the binary Champernowne word (A030190).

Original entry on oeis.org

0, 1, 0, 1, 7, 2, 0, 4, 19, 6, 8, 1, 23, 2, 3, 15, 51, 18, 21, 5, 7, 26, 0, 11, 56, 22, 8, 1, 66, 2, 14, 46, 131, 50, 54, 17, 20, 63, 58, 4, 143, 6, 27, 25, 23, 77, 10, 41, 137, 55, 21, 34, 7, 28, 0, 11, 149, 65, 8, 1, 173, 13, 45, 125, 323, 130, 135, 49, 53
Offset: 0

Views

Author

Rémy Sigrist, Feb 20 2021

Keywords

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.

Examples

			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.
		

Crossrefs

Programs

  • 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

Formula

a(n) = A030304(n) iff n is a binary palindrome (A006995).