login
A161400
Positive integers that are palindromes (of even length) in binary, each made by concatenating two identical binary palindromes.
1
3, 15, 45, 63, 153, 255, 561, 693, 891, 1023, 2145, 2925, 3315, 4095, 8385, 9417, 10965, 11997, 12771, 13803, 15351, 16383, 33153, 39321, 42405, 48573, 50115, 56283, 59367, 65535, 131841, 140049, 152361, 160569, 166725, 174933, 187245
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
FORMULA
a(n) = (2^A070939(p)+1)*p where p = A006995(n+1). [From R. J. Mathar, Sep 27 2009]
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
Cf. A006995.
Sequence in context: A127407 A196237 A177146 * A112810 A334078 A094191
KEYWORD
base,nonn
AUTHOR
Leroy Quet, Jun 09 2009
EXTENSIONS
Extended beyond 693 by R. J. Mathar, Sep 27 2009
STATUS
approved