OFFSET
0,3
LINKS
Rémy Sigrist, Table of n, a(n) for n = 0..8191
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
KEYWORD
AUTHOR
EXTENSIONS
Minor edits by N. J. A. Sloane, Dec 16 2017
STATUS
approved