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 A331804 #12 Jan 28 2020 01:36:53 %S A331804 0,1,1,3,1,5,3,7,1,9,5,5,3,5,7,15,1,17,9,9,5,21,6,7,3,9,5,27,7,7,15, %T A331804 31,1,33,17,17,9,9,9,9,5,9,21,21,6,45,14,15,3,17,9,51,5,21,27,27,7,9, %U A331804 7,27,15,15,31,63,1,65,33,33,17,17,17,17,9,73,10,9 %N A331804 a(n) is the largest positive integer occurring, when written in binary, as a substring in both binary n and its reversal (A030101(n)). %C A331804 We set a(0) = 0 by convention. %C A331804 a(7479) = 29 ("11101" in binary) is the first term that does not belong to A057890. %H A331804 Rémy Sigrist, <a href="/A331804/b331804.txt">Table of n, a(n) for n = 0..8192</a> %F A331804 a(n) = A175466(n, A030101(n)) for any n > 0. %F A331804 a(n) <= n with equality iff n is a binary palindrome (A006995). %e A331804 The first terms, alongside the binary representations of n and of a(n), are: %e A331804 n a(n) bin(n) bin(a(n)) %e A331804 -- ---- ------ --------- %e A331804 0 0 0 0 %e A331804 1 1 1 1 %e A331804 2 1 10 1 %e A331804 3 3 11 11 %e A331804 4 1 100 1 %e A331804 5 5 101 101 %e A331804 6 3 110 11 %e A331804 7 7 111 111 %e A331804 8 1 1000 1 %e A331804 9 9 1001 1001 %e A331804 10 5 1010 101 %e A331804 11 5 1011 101 %e A331804 12 3 1100 11 %o A331804 (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 A331804 a(n) = my (i=setintersect(sub(n), sub(fromdigits(Vecrev(binary(n)),2)))); i[#i] %Y A331804 Cf. A006995, A030101, A047813, A057890, A175466. %K A331804 nonn,base %O A331804 0,4 %A A331804 _Rémy Sigrist_, Jan 26 2020