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!)
A347347 If n is odd, a(n) is the smallest positive integer that is a palindrome when represented in binary, and is made by appending some number (zero or more) of binary digits on the left of n's binary representation. If n is even, then a(n) = 0. 2

%I #16 Aug 30 2021 17:19:17

%S 1,0,3,0,5,0,7,0,9,0,27,0,45,0,15,0,17,0,51,0,21,0,119,0,153,0,27,0,

%T 93,0,31,0,33,0,99,0,165,0,231,0,297,0,107,0,45,0,495,0,561,0,51,0,

%U 693,0,119,0,313,0,443,0,189,0,63,0,65,0,195,0,325,0,455,0

%N If n is odd, a(n) is the smallest positive integer that is a palindrome when represented in binary, and is made by appending some number (zero or more) of binary digits on the left of n's binary representation. If n is even, then a(n) = 0.

%C Base-2 analog of A347346.

%H Chai Wah Wu, <a href="/A347347/b347347.txt">Table of n, a(n) for n = 1..10000</a>

%F If n is odd, then a(n) = A161501(A030101(i)).

%o (Python)

%o def A347347(n):

%o if n % 2 == 0:

%o return 0

%o s = bin(n)[2:]

%o if s == s[::-1]:

%o return n

%o for i in range(1,len(s)):

%o if s[:-i]== s[-i-1::-1]:

%o return int(s[:-i-1:-1]+s,2)

%Y Cf. A030101, A161501, A347346.

%K nonn,base,look

%O 1,3

%A _Chai Wah Wu_, Aug 27 2021

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 8 11:12 EDT 2024. Contains 375021 sequences. (Running on oeis4.)