|
|
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
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
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
|
|
|
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
|
|
CROSSREFS
|
|
|
KEYWORD
|
base,nonn
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|