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.

A301984 a(n) is the greatest positive number k such that the binary digits of any number in the interval 1..k appear in order but not necessarily as consecutive digits in the binary representation of n.

Original entry on oeis.org

1, 2, 1, 2, 3, 3, 1, 2, 5, 6, 3, 4, 3, 3, 1, 2, 5, 6, 5, 6, 7, 7, 3, 4, 7, 7, 3, 4, 3, 3, 1, 2, 5, 6, 5, 6, 11, 11, 5, 6, 13, 14, 7, 8, 7, 7, 3, 4, 9, 10, 7, 8, 7, 7, 3, 4, 7, 7, 3, 4, 3, 3, 1, 2, 5, 6, 5, 6, 11, 11, 5, 6, 13, 14, 11, 12, 11, 11, 5, 6, 13, 14
Offset: 1

Views

Author

Rémy Sigrist, Mar 30 2018

Keywords

Comments

Equivalently, a(n) is the greatest positive number k such that A301983(n, k) = k.
Apparently, the k-th record value is A089633(k), and the first term with this value has index A048678(A089633(k)).

Examples

			The 13th row of A301983 is: 1, 2, 3, 5, 6, 7, 13; all numbers in the range 1..3 appear in this row, but the number 4 is missing; hence a(13) = 3.
		

Crossrefs

Programs

  • PARI
    a(n) = my (b=binary(n), s=Set(1)); for (i=2, #b, s = setunion(s, Set(apply(v -> 2*v+b[i], s)))); for (u=1, oo, if (!setsearch(s,u), return (u-1)))

Formula

a(n) <= A301977(n).
a(2*n) >= a(n).
a(2*n + 1) >= a(n) (with strict inequality if a(n) is even).
a(n) = 1 iff n is positive and belongs to A000225.