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!)
A050422 Numbers for which in base 2 the least number of digits that can be removed to leave a palindrome (possibly beginning with 0) is 3. 2

%I #8 Aug 24 2021 12:56:02

%S 52,56,88,104,112,114,116,120,142,143,150,151,168,176,184,196,200,208,

%T 212,216,220,224,226,228,233,234,236,241,242,244,248,268,270,271,278,

%U 279,282,283,286,287,302,303,304,332,334,335,336,344,352,356,360,376,388

%N Numbers for which in base 2 the least number of digits that can be removed to leave a palindrome (possibly beginning with 0) is 3.

%e (88 base 2) = 1011000 -> 0000.

%o (Python)

%o from itertools import combinations

%o def ok(n):

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

%o for digs_to_remove in range(4):

%o for skip in combinations(range(len(b)), digs_to_remove):

%o newb = "".join(b[i] for i in range(len(b)) if i not in skip)

%o if len(newb) > 0 and newb == newb[::-1]:

%o return (digs_to_remove == 3)

%o return False

%o print(list(filter(ok, range(390)))) # _Michael S. Branicky_, Aug 24 2021

%Y Cf. A050427, A050420, A050421, A050423, A050424.

%K nonn,base

%O 1,1

%A _Clark Kimberling_

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 March 29 04:59 EDT 2024. Contains 371264 sequences. (Running on oeis4.)