The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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. Non-binary-palindromes that are in this sequence are found in sequence A165250.
LINKS
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
Sequence in context: A091177 A066929 A173909 * A098160 A371215 A103701
KEYWORD
base,nonn
AUTHOR
Leroy Quet, Sep 10 2009
EXTENSIONS
More terms from Sean A. Irvine, Nov 17 2009
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 25 17:30 EDT 2024. Contains 372804 sequences. (Running on oeis4.)