Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #25 Sep 16 2022 03:55:22
%S 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,
%T 11,18,6,7,1,192,91,38,85,3,45,20,73,163,67,2,22,40,3,45,49,95,43,139,
%U 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
%N 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).
%C 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).
%H Michael S. Branicky, <a href="/A341766/b341766.txt">Table of n, a(n) for n = 0..16383</a>
%H Scott R. Shannon, <a href="/A341766/a341766.png">Image of the first 100000 terms</a>.
%F From _Michael S. Branicky_, Sep 16 2022: (Start)
%F a(2^k-1) = 1, for k >= 1;
%F a(2^k) = (k+1)*2^k, for k >= 0. (End)
%e a(0) = 3 as '0' starts at position 1 and appears again at position 4.
%e a(1) = 1 as '1' starts at position 2 and appears again at position 3.
%e a(4) = 12 as '100' starts at position 7 and appears again at position 19.
%e a(7) = 1 as '111' starts at position 16 and appears again at position 17.
%e a(8) = 32 as '1000' starts at position 19 and appears again at position 51.
%o (Python)
%o def a(n):
%o b = s = bin(n)[2:]
%o while s.find(b, 1) < 0: n += 1; s += bin(n)[2:]
%o return s.find(b, 1)
%o print([a(n) for n in range(76)]) # _Michael S. Branicky_, Sep 16 2022
%Y Cf. A030190, A337227 (base 10), A296354, A296349, A296355.
%K nonn,base
%O 0,1
%A _Scott R. Shannon_, Feb 19 2021