A138954 Number of complement symmetries in the rotations of the binary expansion of a number.
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
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.
Links
- Andrew Howroyd, Table of n, a(n) for n = 0..1023
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
Comments