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!)
A066196 Primes which have an equal number of zeros and ones in their binary expansion. 10
2, 37, 41, 139, 149, 163, 197, 541, 557, 563, 569, 587, 601, 613, 617, 647, 653, 659, 661, 677, 709, 787, 809, 929, 2141, 2203, 2221, 2251, 2281, 2333, 2347, 2357, 2381, 2389, 2393, 2417, 2467, 2473, 2617, 2659, 2699, 2707, 2713, 2729, 2837, 2851, 2857 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
LINKS
Amiram Eldar, Table of n, a(n) for n = 1..10000 (terms 1..1000 from Harry J. Smith)
FORMULA
A000040 INTERSECT A031443. - R. J. Mathar, Jun 01 2011
MATHEMATICA
Prime[ Select[ Range[ 10^3 ], Count[ IntegerDigits[ Prime[ # ], 2 ], 0 ] == Count[ IntegerDigits[ Prime[ # ], 2 ], 1 ] & ] ]
digBalQ[n_] := Module[{d = IntegerDigits[n, 2], m}, EvenQ@(m = Length@d) && Count[d, 1] == m/2]; Select[Range[3000], PrimeQ[#] && digBalQ[#] &] (* Amiram Eldar, Nov 21 2020 *)
PROG
(PARI) isok(p) = isprime(p) && (2*hammingweight(p) == #binary(p)); \\ Michel Marcus, May 16 2022
(Python)
from itertools import count, islice
from sympy import isprime
from sympy.utilities.iterables import multiset_permutations
def agen():
yield from filter(isprime, (int("1"+"".join(p), 2) for n in count(1) for p in multiset_permutations("0"*n+"1"*(n-1))))
print(list(islice(agen(), 50))) # Michael S. Branicky, May 15 2022
CROSSREFS
Sequence in context: A346067 A290803 A042569 * A107180 A162577 A199980
KEYWORD
nonn,base
AUTHOR
Robert G. Wilson v, Dec 15 2001
STATUS
approved

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 March 28 05:39 EDT 2024. Contains 371235 sequences. (Running on oeis4.)