OFFSET
0,3
COMMENTS
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."
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.
This is the binary next-palindrome function, the base-2 analog of A262038. - N. J. A. Sloane, Dec 08 2015
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..16383
EXAMPLE
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.
MATHEMATICA
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 *)
f[n_] := Block[{id = IntegerDigits[n, 2]}, FromDigits[ BitOr[ id, Reverse@id], 2]]; Array[f, 72] (* Robert G. Wilson v, Nov 07 2010 *)
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Leroy Quet, Mar 24 2010
EXTENSIONS
Extended, with redundant initial entries included, by Dylan Hamilton, Oct 15 2010
Edited with new name and offset by N. J. A. Sloane, Dec 08 2015
STATUS
approved