Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #16 Aug 27 2022 03:13:10
%S 1,5,3,9,5,27,7,17,9,21,27,51,27,93,15,33,17,73,51,165,21,45,93,99,51,
%T 107,27,231,93,189,31,65,33,273,99,73,165,153,231,325,165,85,107,717,
%U 45,93,189,195,99,403,51,843,107,219,119,455,231,471,119,633,189,381,63
%N a(n) = the smallest positive integer that is an (odd) palindrome when represented in binary and that contains within it the binary representation of n.
%C For n is a power of 2 (A000079), a(n) = 2*n + 1.
%C This sequence contains, by definition, those binary palindromes that are odd, i.e., those palindromes without leading zeros. In other words, only integers occurring in sequence A006995 occur in this sequence.
%C a(A006995(n)) = A006995(n). - _Ray Chandler_, Oct 26 2008
%H Michael De Vlieger, <a href="/A145800/b145800.txt">Table of n, a(n) for n = 1..1024</a>
%e 6 in binary is 110. Those integers which contain 110 in their binary representations are 6 (110 in binary), 12 (1100 in binary), 13 (1101 in binary), 14 (1110 in binary), 22 (10110 in binary), 24 (11000 in binary), 25 (11001 in binary), 26 (11010 in binary), 27 (11011 in binary), etc... Now, 27 (11011 in binary) is the smallest of these integers that is a binary palindrome; so a(6) = 27.
%t Table[With[{d = IntegerDigits[n, 2]}, k = 1; While[Nand[SequenceCount[Set[m, IntegerDigits[k, 2]], d] > 0, PalindromeQ@ m], k += 2]; k], {n, 63}] (* _Michael De Vlieger_, Oct 30 2017 *)
%Y Cf. A000079, A006995, A145799
%K base,nonn
%O 1,2
%A _Leroy Quet_, Oct 19 2008
%E Extended by _Ray Chandler_, Oct 26 2008