OFFSET
1,1
FORMULA
EXAMPLE
71 is in the sequence because 71 is a prime and 71_10 = 1000111_2. '1000111' has four 1's and three 0's.
MATHEMATICA
Select[Range[400], PrimeQ[#] && First[d = DigitCount[#, 2]] > Last[d] > 0 &] (* Amiram Eldar, Jan 08 2021 *)
PROG
(PARI) isok(n) = if (isprime(n), my(nb=#binary(n), h=hammingweight(n)); (2*h > nb) && (h < nb)); \\ Michel Marcus, Jan 10 2021
(Python)
from sympy import sieve
A340466_list = [p for p in sieve.primerange(1, 10**4) if len(bin(p))-2 < 2*bin(p).count('1') < 2*len(bin(p))-4] # Chai Wah Wu, Jan 10 2021
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Ctibor O. Zizka, Jan 08 2021
STATUS
approved