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.

A341766 a(n) = difference between the starting positions of the first digit of the binary representation of n, where n starts at its natural position in the string, and the second occurrence of the same string in the binary Champernowne string (starting at 0) 011011100101110111100010011010... (cf. A030190).

Original entry on oeis.org

3, 1, 4, 1, 12, 4, 5, 1, 32, 13, 2, 9, 15, 5, 6, 1, 80, 36, 12, 31, 76, 8, 23, 21, 39, 16, 69, 11, 18, 6, 7, 1, 192, 91, 38, 85, 3, 45, 20, 73, 163, 67, 2, 22, 40, 3, 45, 49, 95, 43, 139, 37, 118, 31, 3, 25, 46, 19, 137, 13, 21, 7, 8, 1, 448, 218, 100, 211, 31, 136, 79, 197, 429, 25, 58, 123
Offset: 0

Views

Author

Scott R. Shannon, Feb 19 2021

Keywords

Comments

Consider the infinite string 011011100101110111100010011010... (cf. A030190) formed by the concatenation of all binary digits of all nonnegative numbers. From the position of the first digit of the binary representation of n, where n starts as its natural position in the string, find the number of digits one has to move forward to get to the start of the second occurrence of n. This is a(n).

Examples

			a(0) = 3 as '0' starts at position 1 and appears again at position 4.
a(1) = 1 as '1' starts at position 2 and appears again at position 3.
a(4) = 12 as '100' starts at position 7 and appears again at position 19.
a(7) = 1 as '111' starts at position 16 and appears again at position 17.
a(8) = 32 as '1000' starts at position 19 and appears again at position 51.
		

Crossrefs

Programs

  • Python
    def a(n):
        b = s = bin(n)[2:]
        while s.find(b, 1) < 0: n += 1; s += bin(n)[2:]
        return s.find(b, 1)
    print([a(n) for n in range(76)]) # Michael S. Branicky, Sep 16 2022

Formula

From Michael S. Branicky, Sep 16 2022: (Start)
a(2^k-1) = 1, for k >= 1;
a(2^k) = (k+1)*2^k, for k >= 0. (End)