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).

Original entry on oeis.org

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

Views

Author

Keywords

Crossrefs

Cf. A030190, A030302, A031297 (decimal variant), A055143.

Programs

  • 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 *)
  • 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

Formula

a(n) = 1 iff n belongs to A055143. - Rémy Sigrist, Feb 20 2021

Extensions

Minor edits by N. J. A. Sloane, Dec 16 2017