login
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*.
2

%I #9 Jun 27 2024 12:56:22

%S 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,

%T 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,

%U 6,6,4,2,4,2,7,4,6,7,4,2,6,2,7,2,3,3,3

%N 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*.

%H Rémy Sigrist, <a href="/A373553/a373553.gp.txt">PARI program</a>

%H <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>

%F a(n) >= A144016(n).

%F a(2^k - 1) = 1 for any k > 0.

%e 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.

%o (PARI) \\ See Links section.

%o (Python)

%o def a(n):

%o mstar = bin(n)[2:]*2

%o knot = next(k for k in range(2, n+2) if bin(k)[2:] not in mstar)

%o return knot - 1

%o print([a(n) for n in range(1, 88)]) # _Michael S. Branicky_, Jun 14 2024

%Y Cf. A144016, A373399.

%K nonn,base

%O 1,2

%A _Rémy Sigrist_, Jun 09 2024