login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 56th year, we are closing in on 350,000 sequences, and we’ve crossed 9,700 citations (which often say “discovered thanks to the OEIS”).

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
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, 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, 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 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,1

LINKS

Table of n, a(n) for n=0..104.

FORMULA

a(n) = A010051(A000120(n)). - R. J. Mathar, Apr 09 2008

EXAMPLE

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

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

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

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

MAPLE

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

MATHEMATICA

Table[If[PrimeQ[Plus @@ IntegerDigits[n, 2]], 1, 0], {n, 0, 100}] (* Stefan Steinerberger, Apr 09 2008 *)

PROG

(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

CROSSREFS

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

Sequence in context: A093385 A252743 A135136 * A093386 A219098 A288710

Adjacent sequences:  A137328 A137329 A137330 * A137332 A137333 A137334

KEYWORD

nonn,easy,base

AUTHOR

George Pollard, Apr 07 2008

EXTENSIONS

More terms from R. J. Mathar and Stefan Steinerberger, Apr 09 2008

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified December 5 12:24 EST 2021. Contains 349557 sequences. (Running on oeis4.)