login

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 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A340466
Primes whose binary expansion contains more 1's than 0's but at least one 0.
0
5, 11, 13, 19, 23, 29, 43, 47, 53, 59, 61, 71, 79, 83, 89, 101, 103, 107, 109, 113, 151, 157, 167, 173, 179, 181, 191, 199, 211, 223, 227, 229, 233, 239, 241, 251, 271, 283, 307, 311, 313, 317, 331, 347, 349, 359, 367, 373, 379, 383, 397, 409, 419, 421, 431
OFFSET
1,1
FORMULA
{ A095070 } minus { A000225 }.
{ A095070 } minus { A000668 }.
{ A095070 } intersect { A138837 }.
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
KEYWORD
nonn,base,easy
AUTHOR
Ctibor O. Zizka, Jan 08 2021
STATUS
approved