OFFSET
1,1
COMMENTS
LINKS
Antti Karttunen, Table of n, a(n) for n = 1..16303
EXAMPLE
63 ("111111" in binary) is included because there are 0 zero-bits and six 1-bits.
191 ("10111111" in binary) is included because there is 1 zero-bit and seven 1-bits, thus there are six 1-bits more than the number of 0-bits.
PROG
(Scheme, with Antti Karttunen's IntSeq-library)
(Perl) use ntheory ":all"; my $bits = 0; for (1..1000) { my $o = hammingweight($_); $bits++ if ($_ & ($_-1))==0; say if $o == 6+$bits-$o; } # Dana Jacobsen, Dec 16 2015
(PARI) is(n)=2*hammingweight(n)==6+#binary(n) \\ Charles R Greathouse IV, Dec 16 2015
(PARI) for(b=3, 6, for(n=2^(2*b-1), 4^b-1, if(hammingweight(n)==3+b, print1(n", ")))) \\ Charles R Greathouse IV, Dec 16 2015
(PARI) listBBitMembers(b)=if(b%2, return([])); my(u=List()); forvec(v=vector(3+b/2, i, [0, b-1]), listput(u, sum(i=1, #v, 2^v[i])), 2); Vec(u) \\ Charles R Greathouse IV, Dec 16 2015
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Antti Karttunen, Mar 11 2015
STATUS
approved