OFFSET
1,1
COMMENTS
If m is the n-th positive integer that is a binary palindrome, and m written in binary is k digits long, then a(n) = m*(2^k +1).
LINKS
Harvey P. Dale, Table of n, a(n) for n = 1..10000
FORMULA
EXAMPLE
The first eight terms of this sequence written in binary: 11, 1111, 101101, 111111, 10011001, 11111111, 1000110001, 1010110101.
MATHEMATICA
Union[Flatten[Table[FromDigits[Join[#, #], 2]&/@Select[Tuples[ {1, 0}, n], First[ #]!=0&&Last[#]!=0&&#==Reverse[#]&], {n, 10}]]] (* Harvey P. Dale, Jul 15 2014 *)
PROG
(Python)
from itertools import product
def bin_pals():
yield "1"
digits, midrange = 2, [[""], ["0", "1"]]
while True:
for p in product("01", repeat=digits//2-1):
left = "1"+"".join(p)
for middle in midrange[digits%2]:
yield left+middle+left[::-1]
digits += 1
def aupton(terms):
alst, bgen = [], bin_pals()
while len(alst) < terms: b = next(bgen); alst.append(int(b+b, 2))
return alst
print(aupton(37)) # Michael S. Branicky, Mar 15 2021
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Leroy Quet, Jun 09 2009
EXTENSIONS
Extended beyond 693 by R. J. Mathar, Sep 27 2009
STATUS
approved