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!)
A137331 a(n) = 1 if the binary weight of n is prime, otherwise 0. 1

%I #8 Mar 02 2015 02:13:16

%S 0,0,0,1,0,1,1,1,0,1,1,1,1,1,1,0,0,1,1,1,1,1,1,0,1,1,1,0,1,0,0,1,0,1,

%T 1,1,1,1,1,0,1,1,1,0,1,0,0,1,1,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,1,

%U 1,1,1,0,1,1,1,0,1,0,0,1,1,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,1,1,0,1,0,0,1,1

%N a(n) = 1 if the binary weight of n is prime, otherwise 0.

%F a(n) = A010051(A000120(n)). - _R. J. Mathar_, Apr 09 2008

%e a(0) = 0 (binary). Bits set = 0, 0 not prime -> 0.

%e a(1) = 1 (binary). Bits set = 1, 1 not prime -> 0.

%e a(2) = 10 (binary). Bits set = 1, 1 not prime -> 0.

%e a(3) = 11 (binary). Bits set = 2, 2 prime -> 1.

%p A000120 := proc(n) add(i,i=convert(n,base,2)) ; end: A010051 := proc(n) if isprime(n) then 1 ; else 0 ; fi ; end: A137331 := proc(n) A010051(A000120(n)) ; end: seq(A137331(n),n=0..200) ; # _R. J. Mathar_, Apr 09 2008

%t Table[If[PrimeQ[Plus @@ IntegerDigits[n, 2]], 1, 0], {n, 0, 100}] (* _Stefan Steinerberger_, Apr 09 2008 *)

%o (PARI)f(n)={v=binary(n);s=0;for(k=1,#v,if(v[k]== 1,s++));return(isprime(s))};for(n=0,104,if(f(n),print1("1, "),print1("0, "))) \\ _Washington Bomfim_, Jan 14 2011

%Y Begins the same as A135136, but differs starting at a(31).

%K nonn,easy,base

%O 0,1

%A _George Pollard_, Apr 07 2008

%E More terms from _R. J. Mathar_ and _Stefan Steinerberger_, Apr 09 2008

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 April 19 11:31 EDT 2024. Contains 371792 sequences. (Running on oeis4.)