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 A161502 #15 Aug 27 2021 13:05:30 %S A161502 0,1,0,1,0,2,0,1,0,1,2,2,1,3,0,1,0,2,3,3,0,1,2,2,1,2,0,3,2,4,0,1,0,3, %T A161502 4,1,3,2,3,3,2,1,4,4,0,1,2,2,1,3,0,4,1,2,3,3,2,3,1,4,3,5,0,1,0,4,5,2, %U A161502 4,3,4,4,0,2,5,1,4,2,3,3,2,1,5,5,0,3,4,4,3,4,2,5,0,1,2,2,1,4,0,2,4,3,4,4,3 %N A161502 a(n) is the smallest number of binary digits that when appended to the right side of the binary representation of n, forms a binary palindrome. %e A161502 11 (decimal) in binary is 1011. Appending 01 to the right side of 1011 forms the binary palindrome 101101, which is 45 in decimal. Since two binary digits is the smallest number of digits that need to be appended on the right side of binary n to form a palindrome, then a(11) = 2. (Note that 45 is not the smallest positive number that when represented in binary is a palindrome and contains 1011 as a substring. That would instead be 11011 {binary} = 27 {decimal}.) %o A161502 (Python) %o A161502 def A161502(n): %o A161502 s = bin(n)[2:] %o A161502 if s == s[::-1]: %o A161502 return 0 %o A161502 for i in range(1,len(s)): %o A161502 if s[i:] == s[-1:i-1:-1]: %o A161502 return i # _Chai Wah Wu_, Aug 27 2021 %Y A161502 Cf. A145800, A161501. %K A161502 base,nonn %O A161502 1,6 %A A161502 _Leroy Quet_, Jun 11 2009 %E A161502 More terms from _Sean A. Irvine_, Sep 27 2009