OFFSET
1,1
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
EXAMPLE
(20 base 2) = 101000 -> 0000.
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;
if ormap(i -> subsop(i=NULL, L)=subsop(m+1-i=NULL, R), [$1..m]) then return false fi;
ormap(p -> subsop(p[1]=NULL, subsop(p[2]=NULL, L))=subsop(m-p[1]=NULL, subsop(m+1-p[2]=NULL, R)), [seq(seq([i, j], j=i+1..m), i=1..m-1)])
end proc:
select(filter, [$4..200]); # Robert Israel, Oct 28 2020
PROG
(Python)
from itertools import combinations
def ok(n):
b = bin(n)[2:]
for digs_to_remove in range(4):
for skip in combinations(range(len(b)), digs_to_remove):
newb = "".join(b[i] for i in range(len(b)) if i not in skip)
if len(newb) > 0 and newb == newb[::-1]:
return (digs_to_remove == 2)
return False
print(list(filter(ok, range(173)))) # Michael S. Branicky, Aug 24 2021
CROSSREFS
KEYWORD
nonn,base
AUTHOR
STATUS
approved