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.

A030304 Least k such that the base-2 representation of n begins at s(k), where s=A030190 (or equally A030302).

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