A373553 For any number m, let m* be the bi-infinite string obtained by repetition of the binary expansion of m; a(n) is the largest positive integer k such that the binary expansions of all positive integers <= k are found within n*.
1, 2, 1, 2, 3, 3, 1, 2, 4, 2, 3, 4, 3, 3, 1, 2, 4, 2, 4, 2, 3, 3, 3, 4, 4, 3, 3, 4, 3, 3, 1, 2, 4, 2, 4, 2, 6, 6, 4, 2, 6, 2, 3, 6, 3, 3, 3, 4, 4, 6, 4, 6, 3, 3, 3, 4, 4, 3, 3, 4, 3, 3, 1, 2, 4, 2, 4, 2, 6, 6, 4, 2, 4, 2, 7, 4, 6, 7, 4, 2, 6, 2, 7, 2, 3, 3, 3
Offset: 1
Examples
For n = 9: the binary expansion of 9 is "1001", 9* looks like "...10011001..." and contains the binary expansions of 1, 2, 3 and 4, but not of 5, so a(9) = 4.
Links
Programs
-
PARI
\\ See Links section.
-
Python
def a(n): mstar = bin(n)[2:]*2 knot = next(k for k in range(2, n+2) if bin(k)[2:] not in mstar) return knot - 1 print([a(n) for n in range(1, 88)]) # Michael S. Branicky, Jun 14 2024
Formula
a(n) >= A144016(n).
a(2^k - 1) = 1 for any k > 0.