login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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)
def A161978(n):
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
return n+i # John Tyler Rascoe, Mar 11 2023
CROSSREFS
Cf. A030101.
Sequence in context: A095205 A344325 A366389 * A132579 A004850 A260096
KEYWORD
base,look,nonn
AUTHOR
Leroy Quet, Jun 23 2009
EXTENSIONS
Corrected and extended by Sean A. Irvine, Nov 09 2009
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 4 19:39 EDT 2024. Contains 374925 sequences. (Running on oeis4.)