OFFSET
0,3
LINKS
PROG
(Python)
from itertools import count, islice, product
def pals(startd=1): # generator for base-10 palindromes
for d in count(startd):
for p in product("0123456789", repeat=d//2):
if d//2 > 0 and p[0] == "0": continue
left = "".join(p); right = left[::-1]
for mid in [[""], "0123456789"][d%2]:
yield int(left + mid + right)
def a(n):
for p in pals(startd=len(str(2**n-1))):
if bin(p).count("1") == n:
return p
print([a(n) for n in range(33)]) # Michael S. Branicky, Jun 02 2022
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Ilya Gutkovskiy, Jun 02 2022
EXTENSIONS
a(21)-a(32) from Michael S. Branicky, Jun 02 2022
STATUS
approved