|
|
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
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,3
|
|
LINKS
|
|
|
FORMULA
|
|
|
MATHEMATICA
|
nmax = 100;
s = Table[IntegerDigits[n, 2], {n, 0, nmax}] // Flatten;
a[n_] := SequencePosition[s, IntegerDigits[n, 2], 1][[1, 1]] - 1;
|
|
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)
|
|
CROSSREFS
|
|
|
KEYWORD
|
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|