login
A030304
Least k such that the base-2 representation of n begins at s(k), where s=A030190 (or equally A030302).
7
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, 11, 15, 46, 130, 50, 18, 55, 154, 6, 22, 65, 146, 63, 26, 28, 163, 77, 2, 13, 49, 17, 5, 34, 69, 25, 79, 1, 16, 4, 68, 11, 15, 41, 46, 125, 322, 130, 50
OFFSET
0,3
LINKS
FORMULA
a(n) = 1 iff n belongs to A055143. - Rémy Sigrist, Feb 20 2021
MATHEMATICA
nmax = 100;
s = Table[IntegerDigits[n, 2], {n, 0, nmax}] // Flatten;
a[n_] := SequencePosition[s, IntegerDigits[n, 2], 1][[1, 1]] - 1;
a /@ Range[0, nmax] (* Jean-François Alcover, Feb 21 2021 *)
PROG
(Perl) $bb = ""; foreach $n (0..66) { print index($bb .= $b = sprintf("%b", $n), $b), ", "; } # Rémy Sigrist, Aug 19 2020
(Python)
from itertools import count, islice
def agen():
k, chap = 0, "0"
for n in count(0):
target = bin(n)[2:]
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
CROSSREFS
Cf. A030190, A030302, A031297 (decimal variant), A055143.
Sequence in context: A331654 A346864 A302690 * A248779 A286030 A343684
KEYWORD
nonn,look,base
EXTENSIONS
Minor edits by N. J. A. Sloane, Dec 16 2017
STATUS
approved