%I #22 Dec 30 2017 11:38:07
%S 0,1,3,3,5,5,7,7,9,9,15,15,15,15,15,15,17,17,27,27,21,21,31,31,27,27,
%T 27,27,31,31,31,31,33,33,51,51,45,45,63,63,45,45,63,63,45,45,63,63,51,
%U 51,51,51,63,63,63,63,63,63,63,63,63,63,63,63,65,65,99,99,85,85,119,119,73
%N Smallest number >=n whose binary representation is palindromic and has a 1 whenever the binary representation of n has a 1.
%C Old name: "Convert n to binary. OR each respective digit of binary n and binary A030101(n), where A030101(n) is the reversal of the order of the digits in the binary representation of n (given in decimal). a(n) is the decimal value of the result."
%C By "respective" digits of binary n and binary A030101(n), the rightmost digit of A030101(n) ( which is a 1) is OR'ed with the rightmost digit of n. A030101(n) is represented with the appropriate number of leading 0's.
%C This is the binary next-palindrome function, the base-2 analog of A262038. - _N. J. A. Sloane_, Dec 08 2015
%H Alois P. Heinz, <a href="/A175298/b175298.txt">Table of n, a(n) for n = 0..16383</a>
%e 20 in binary is 10100. The reversal of the binary digits is 00101. So, from leftmost to rightmost respective digits, we OR 10100 and 00101: 1 OR 0 = 1. 0 OR 0 = 0. 1 OR 1 = 1. 0 OR 0 = 0. And 0 OR 1 = 1. So, 10100 OR 00101 is 10101, which is 21 in decimal. So a(20) = 21.
%t Table[f = IntegerDigits[x, 2]; f = f + Reverse[f]; FromDigits[ Table[If[Positive[f[[r]]], 1, 0], {r, 1, Length[f]}], 2], {x, STARTPOINT, ENDPOINT}] (* _Dylan Hamilton_, Oct 15 2010 *)
%t f[n_] := Block[{id = IntegerDigits[n, 2]}, FromDigits[ BitOr[ id, Reverse@id], 2]]; Array[f, 72] (* _Robert G. Wilson v_, Nov 07 2010 *)
%Y Cf. A006995, A030101, A175297, A262038.
%Y Sequences related to palindromic floor and ceiling: A175298, A206913, A206914, A261423, A262038, and the large block of consecutive sequences beginning at A265509.
%K base,nonn
%O 0,3
%A _Leroy Quet_, Mar 24 2010
%E Extended, with redundant initial entries included, by _Dylan Hamilton_, Oct 15 2010
%E Edited with new name and offset by _N. J. A. Sloane_, Dec 08 2015