login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A342040
Binary palindromes of odd length.
2
1, 101, 111, 10001, 10101, 11011, 11111, 1000001, 1001001, 1010101, 1011101, 1100011, 1101011, 1110111, 1111111, 100000001, 100010001, 100101001, 100111001, 101000101, 101010101, 101101101, 101111101, 110000011, 110010011, 110101011
OFFSET
1,2
COMMENTS
Subsequence of A057148.
FORMULA
a(n) = A007088(A048700(n)).
MATHEMATICA
a[1] = 1; a[n_] := FromDigits[Join[#, {Mod[n, 2]}, Reverse[#]] &@ IntegerDigits[Floor[n/2], 2]]; Array[a, 26] (* Amiram Eldar, Apr 28 2021 *)
PROG
(Python)
def A342040(n):
s = bin(n)[2:]
return int(s+s[-2::-1]) # Chai Wah Wu, Feb 26 2021
KEYWORD
nonn,base,easy
AUTHOR
Seiichi Manyama, Feb 26 2021
STATUS
approved