

A165249


Those positive integers n where the number of 1's, when n is written in binary, on the left half of the binary representation equals the number of 1's on the right half of the binary representation.


2



1, 3, 5, 7, 9, 10, 15, 17, 18, 21, 22, 27, 31, 33, 34, 36, 43, 45, 46, 51, 53, 54, 63, 65, 66, 68, 73, 74, 76, 83, 85, 86, 91, 93, 94, 99, 101, 102, 107, 109, 110, 119, 127, 129, 130, 132, 136, 147, 149, 150, 153, 154, 156, 163, 165, 166, 169, 170, 172, 183, 187, 189
(list;
graph;
refs;
listen;
history;
text;
internal format)



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. Nonbinarypalindromes 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[nbi+1]); } \\ Michel Marcus, Jun 05 2018


CROSSREFS

Cf. A006995, A165250.
Sequence in context: A091177 A066929 A173909 * A098160 A103701 A206544
Adjacent sequences: A165246 A165247 A165248 * A165250 A165251 A165252


KEYWORD

base,nonn


AUTHOR

Leroy Quet, Sep 10 2009


EXTENSIONS

More terms from Sean A. Irvine, Nov 17 2009


STATUS

approved



