|
|
A050423
|
|
Numbers for which in base 2 the least number of digits that can be removed to leave a palindrome (possibly beginning with 0) is 4.
|
|
4
|
|
|
232, 240, 368, 424, 432, 440, 452, 456, 464, 468, 472, 480, 482, 484, 488, 496, 542, 543, 558, 559, 688, 720, 736, 752, 816, 848, 864, 868, 872, 888, 900, 912, 920, 928, 932, 960, 962, 970, 972, 977, 978, 980, 984, 993, 994, 996, 1000, 1008, 1052, 1054, 1055, 1068, 1070, 1071, 1078, 1079
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
LINKS
|
|
|
EXAMPLE
|
464 is a term because is 464 = 111010000_2 and deleting the four 1's gives the palindrome 00000 and there is no way to delete fewer bits and get a palindrome. - Sean A. Irvine, Aug 15 2021
|
|
PROG
|
(Python)
from itertools import combinations
def ok(n):
b = bin(n)[2:]
for digs_to_remove in range(5):
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 newb == newb[::-1]: return (digs_to_remove == 4)
return False
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|