cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A138954 Number of complement symmetries in the rotations of the binary expansion of a number.

Original entry on oeis.org

0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 2, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Offset: 0

Views

Author

Max Sills, Apr 03 2008

Keywords

Comments

It seems that the number of complement rotational symmetries is nonzero iff #0 = #1 in the binary expansion of a number.
The above statement is true in only one direction. It is clearly necessary for the number of 1 bits to equal the number of 0 bits. However, this is not sufficient. The first counterexample is n = 37 with binary expansion 100101 and complement 011010. Values of n for which a(n) is nonzero are therefore a proper subset of A031443. - Andrew Howroyd, Jan 12 2020

Examples

			a(2) = 1 because 2 has binary expansion 10 and the complement shows up once in rotations;
a(10) = 2 because 10 has binary expansion 1010 and its complement shows up twice in rotations.
		

Crossrefs

Programs

  • PARI
    a(n)={my(s=0); if(n, my(b=logint(n,2)+1); if(2*hammingweight(n)==b, my(w=2^b-1-n); for(i=2, b, w=if(w%2, w+2^b, w)\2; if(w==n, s++)))); s} \\ Andrew Howroyd, Jan 12 2020

Extensions

Missing a(8) inserted and terms a(21) and beyond from Andrew Howroyd, Jan 12 2020