OFFSET
1,2
COMMENTS
The middle binary digit of those positive integers with an odd number of binary digits can be considered to either be on both the left and the right side of the number, or to be on neither side. In other words, the middle binary digit can be ignored.
We could instead count the 0's in both halves of the binary representations. If the number of 0's is the same for both halves of the binary representation of n, then n is in this sequence.
All positive integers that are palindromes in binary are in this sequence. Non-binary-palindromes that are in this sequence are found in sequence A165250.
LINKS
Harvey P. Dale, Table of n, a(n) for n = 1..1000
EXAMPLE
46 in binary is 101110. Splitting the binary representation down the middle, we have (101)(110). Since there are exactly the same number (two) of 1's in both halves, then 46 is in this sequence.
MATHEMATICA
n1Q[n_]:=Module[{idn2=IntegerDigits[n, 2], len, lft, rgt}, len=Floor[ Length[ idn2]/2]; lft=Total[Take[idn2, len]]; rgt=Total[Take[idn2, -len]]; lft == rgt]; Select[Range[200], n1Q] (* Harvey P. Dale, Jan 17 2020 *)
PROG
(PARI) isok(n) = {my(b = binary(n), nb = #b); sum(i=1, nb\2, b[i]) == sum(i=1, nb\2, b[nb-i+1]); } \\ Michel Marcus, Jun 05 2018
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Leroy Quet, Sep 10 2009
EXTENSIONS
More terms from Sean A. Irvine, Nov 17 2009
STATUS
approved