OFFSET
1,1
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
EXAMPLE
(72 base 2) = 1001000 -> 1001.
MAPLE
filter:= proc(n) local L, Lp, m, i, c;
L:= convert(n, base, 2);
m:= nops(L);
for i from 1 to m do
Lp:= subsop(i=NULL, L);
if Lp[-1] = 1 and andmap(t -> Lp[t]=Lp[-t], [$1..(m-1)/2]) then return false fi
od;
for c in combinat:-choose(m, 2) do
Lp:= subsop(seq(i=NULL, i=c), L);
if Lp[-1] = 1 and andmap(t -> Lp[t]=Lp[-t], [$1..(m-2)/2]) then return false fi;
od;
for c in combinat:-choose(m, 3) do
Lp:= subsop(seq(i=NULL, i=c), L);
if Lp[-1] = 1 and andmap(t -> Lp[t]=Lp[-t], [$1..(m-2)/2]) then return true fi;
od;
false
end proc;
select(filter, [$8..1000]); # Robert Israel, Mar 18 2026
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[0] == '1' and newb == newb[::-1]:
return (digs_to_remove == 3)
return False
print(list(filter(ok, range(320)))) # Michael S. Branicky, Aug 24 2021
CROSSREFS
KEYWORD
nonn,base
AUTHOR
STATUS
approved
