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.
%I A331803 #9 Jan 28 2020 01:36:57 %S A331803 0,1,1,1,2,2,3,1,4,2,5,3,6,6,7,1,8,4,9,4,10,5,11,3,12,6,13,6,14,14,15, %T A331803 1,16,8,17,4,18,9,19,4,20,10,21,11,22,11,23,3,24,12,25,6,26,13,27,7, %U A331803 28,14,29,14,30,30,31,1,32,16,33,8,34,17,35,8,36,18 %N A331803 a(n) is the largest positive integer occurring, when written in binary, as a substring in both binary n and binary n+1. %C A331803 We set a(0) = 0 by convention. %H A331803 Rémy Sigrist, <a href="/A331803/b331803.txt">Table of n, a(n) for n = 0..8192</a> %F A331803 a(n) = A175466(n, n+1) for any n > 0. %F A331803 a(2*n) = n. %F A331803 a(2^k-1) = 1 for any k > 0. %e A331803 The first terms, alongside the binary representations of n, n+1 and a(n), are: %e A331803 n a(n) bin(n) bin(n+1) bin(a(n)) %e A331803 -- ---- ------ -------- --------- %e A331803 0 0 0 1 0 %e A331803 1 1 1 10 1 %e A331803 2 1 10 11 1 %e A331803 3 1 11 100 1 %e A331803 4 2 100 101 10 %e A331803 5 2 101 110 10 %e A331803 6 3 110 111 11 %e A331803 7 1 111 1000 1 %e A331803 8 4 1000 1001 100 %e A331803 9 2 1001 1010 10 %e A331803 10 5 1010 1011 101 %o A331803 (PARI) sub(n) = { my (b=binary(n), s=[0]); for (i=1, #b, if (b[i], for (j=i, #b, s=setunion(s, Set(fromdigits(b[i..j], 2)))))); return (s) } %o A331803 a(n) = my (i=setintersect(sub(n), sub(n+1))); i[#i] %Y A331803 Cf. A175466. %K A331803 nonn,base %O A331803 0,5 %A A331803 _Rémy Sigrist_, Jan 26 2020