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.

A144754 Integers that have a prime number of 0's in their binary expansion.

Original entry on oeis.org

4, 8, 9, 10, 12, 17, 18, 19, 20, 21, 22, 24, 25, 26, 28, 32, 35, 37, 38, 39, 41, 42, 43, 44, 45, 46, 49, 50, 51, 52, 53, 54, 56, 57, 58, 60, 65, 66, 68, 71, 72, 75, 77, 78, 79, 80, 83, 85, 86, 87, 89, 90, 91, 92, 93, 94, 96, 99, 101, 102, 103, 105, 106, 107, 108, 109, 110
Offset: 1

Views

Author

Leroy Quet, Sep 20 2008

Keywords

Examples

			66 written in binary is 1000010. This has five 0's and five is a prime. So 66 is included in the sequence.
		

Crossrefs

Cf. A052294.

Programs

  • Mathematica
    Select[Range@ 120, PrimeQ@ DigitCount[#, 2, 0] &] (* Michael De Vlieger, Oct 26 2017 *)
  • PARI
    isok(n) = isprime(#binary(n) - hammingweight(n)); \\ Michel Marcus, Feb 23 2016
    
  • Python
    from sympy import isprime
    i=j=1
    while j<=250:
        if isprime(bin(i)[2:].count("0")):
            print(str(j)+" "+str(i))
            j+=1
        i+=1 # Indranil Ghosh, Feb 03 2017

Extensions

Many more terms from Reikku Kulon, Sep 21 2008
Name edited by Michel Marcus, Apr 30 2021