login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A050420
Numbers for which in base 2 the least number of digits that can be removed to leave a palindrome (possibly beginning with 0) is 1.
4
2, 4, 6, 8, 10, 11, 13, 14, 16, 18, 19, 22, 23, 25, 29, 30, 32, 34, 35, 36, 37, 41, 42, 43, 46, 47, 49, 53, 54, 55, 59, 61, 62, 64, 66, 67, 69, 76, 77, 81, 82, 83, 89, 90, 91, 94, 95, 97, 101, 102, 103, 109, 111, 115, 123, 125, 126, 128, 130, 131, 133, 136
OFFSET
1,1
LINKS
EXAMPLE
(18 base 2) = 10010 -> 1001.
MAPLE
filter:= proc(n) local L, R, k, m;
L:= convert(n, base, 2);
R:= ListTools:-Reverse(L);
m:= nops(L);
if L = R then return false fi;
ormap(i -> subsop(i=NULL, L)=subsop(m+1-i=NULL, R), [$1..m]);
end proc:
select(filter, [$1..200]); # Robert Israel, Oct 28 2020
PROG
(Python)
def ok(n):
b = bin(n)[2:]
if b == b[::-1]: return False
for skip in range(len(b)):
newb = b[:skip] + b[skip+1:]
if len(newb) > 0 and newb == newb[::-1]:
return True
return False
print(list(filter(ok, range(137)))) # Michael S. Branicky, Aug 24 2021
CROSSREFS
Includes A164302.
Supersequence of A050425 (beginning with 1).
Sequence in context: A067030 A072427 A337430 * A214671 A291171 A334614
KEYWORD
nonn,base
STATUS
approved