cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A340466 Primes whose binary expansion contains more 1's than 0's but at least one 0.

Original entry on oeis.org

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

Views

Author

Ctibor O. Zizka, Jan 08 2021

Keywords

Examples

			71 is in the sequence because 71 is a prime and 71_10 = 1000111_2. '1000111' has four 1's and three 0's.
		

Crossrefs

Programs

  • Mathematica
    Select[Range[400], PrimeQ[#] && First[d = DigitCount[#, 2]] > Last[d] > 0 &] (* Amiram Eldar, Jan 08 2021 *)
  • 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

Formula

{ A095070 } minus { A000225 }.
{ A095070 } minus { A000668 }.
{ A095070 } intersect { A138837 }.