login
A050429
Numbers for which in base 2 the least number of digits that can be removed to leave a base 2 palindromic number (beginning with 1) is 5.
4
32, 96, 160, 176, 208, 224, 288, 304, 312, 368, 400, 456, 464, 480, 544, 560, 568, 572, 592, 600, 604, 632, 656, 672, 688, 696, 752, 784, 840, 848, 864, 880, 904, 932, 936, 944, 964, 968, 976, 992, 1056, 1072, 1080, 1084, 1086, 1104, 1112, 1116, 1118, 1128
OFFSET
1,1
PROG
(Python)
from itertools import combinations
def ok(n):
b = bin(n)[2:]
for digs_to_remove in range(6):
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 == 5)
return False
print(list(filter(ok, range(1129)))) # Michael S. Branicky, Aug 15 2021
CROSSREFS
Sequence in context: A208635 A259715 A195088 * A362841 A044219 A044600
KEYWORD
nonn,base
EXTENSIONS
Data corrected and extended by Sean A. Irvine, Aug 15 2021
STATUS
approved