%I #27 Oct 07 2022 09:09:52
%S 0,1,2,1,6,2,1,4,18,6,26,2,5,1,4,15,50,18,6,22,63,26,77,2,17,5,25,1,4,
%T 11,15,46,130,50,18,55,154,6,22,65,146,63,26,28,163,77,2,13,49,17,5,
%U 34,69,25,79,1,16,4,68,11,15,41,46,125,322,130,50
%N Least k such that the base-2 representation of n begins at s(k), where s=A030190 (or equally A030302).
%H Rémy Sigrist, <a href="/A030304/b030304.txt">Table of n, a(n) for n = 0..8191</a>
%F a(n) = 1 iff n belongs to A055143. - _Rémy Sigrist_, Feb 20 2021
%t nmax = 100;
%t s = Table[IntegerDigits[n, 2], {n, 0, nmax}] // Flatten;
%t a[n_] := SequencePosition[s, IntegerDigits[n, 2], 1][[1, 1]] - 1;
%t a /@ Range[0, nmax] (* _Jean-François Alcover_, Feb 21 2021 *)
%o (Perl) $bb = ""; foreach $n (0..66) { print index($bb .= $b = sprintf("%b", $n), $b), ", "; } # _Rémy Sigrist_, Aug 19 2020
%o (Python)
%o from itertools import count, islice
%o def agen():
%o k, chap = 0, "0"
%o for n in count(0):
%o target = bin(n)[2:]
%o while chap.find(target) == -1: k += 1; chap += bin(k)[2:]
%o yield chap.find(target)
%o print(list(islice(agen(), 70))) # _Michael S. Branicky_, Oct 06 2022
%Y Cf. A030190, A030302, A031297 (decimal variant), A055143.
%K nonn,look,base
%O 0,3
%A _Clark Kimberling_
%E Minor edits by _N. J. A. Sloane_, Dec 16 2017