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.

This page as a plain text file.
%I A138954 #11 Feb 27 2020 22:46:17
%S A138954 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,
%T A138954 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,
%U A138954 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
%N A138954 Number of complement symmetries in the rotations of the binary expansion of a number.
%C A138954 It seems that the number of complement rotational symmetries is nonzero iff #0 = #1 in the binary expansion of a number.
%C A138954 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
%H A138954 Andrew Howroyd, <a href="/A138954/b138954.txt">Table of n, a(n) for n = 0..1023</a>
%e A138954 a(2) = 1 because 2 has binary expansion 10 and the complement shows up once in rotations;
%e A138954 a(10) = 2 because 10 has binary expansion 1010 and its complement shows up twice in rotations.
%o A138954 (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
%Y A138954 Cf. A031443, A138904.
%K A138954 easy,nonn
%O A138954 0,11
%A A138954 _Max Sills_, Apr 03 2008
%E A138954 Missing a(8) inserted and terms a(21) and beyond from _Andrew Howroyd_, Jan 12 2020