

A161978


a(n) = the smallest positive integer that when written in binary contains both binary n and {the string formed from the reversal of the binary digits of n, with leading 0's removed} as (possibly overlapping) substrings.


1



1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 27, 12, 27, 14, 15, 16, 17, 18, 51, 20, 21, 45, 93, 24, 51, 90, 27, 28, 93, 30, 31, 32, 33, 34, 99, 36, 165, 102, 231, 40, 165, 42, 107, 108, 45, 93, 189, 48, 99, 306, 51, 180, 107, 54, 119, 56, 231, 186, 119, 60, 189, 62, 63, 64, 65, 66, 195
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,2


LINKS



EXAMPLE

22 in binary is 10110. The binary string with the smallest numerical value that contains both 10110 and its reversal (with the leading 0 removed), 1101, is 101101. a(22) is the numerical value (written in decimal) of this binary string, which is 45.


PROG

(Python)
b, i = bin(n)[2:], 1
r = b[::1]
s = r.index('1')
while n:
i += 1
k = bin(n+i)[2:]
if k.find(b) != 1:
if k.find(r[s:]) != 1: break


CROSSREFS



KEYWORD



AUTHOR



EXTENSIONS



STATUS

approved



