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.

A095074 Primes in whose binary expansion the number of 0-bits is less than or equal to number of 1-bits.

Original entry on oeis.org

2, 3, 5, 7, 11, 13, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 71, 79, 83, 89, 101, 103, 107, 109, 113, 127, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 271, 283, 307, 311, 313, 317, 331, 347, 349, 359
Offset: 1

Views

Author

Antti Karttunen, Jun 01 2004

Keywords

Examples

			From _Indranil Ghosh_, Feb 03 2017: (Start)
29 is in the sequence because 29_10 = 11101_2. '11101' has one 0 and three 1's.
37 is in the sequence because 37_10 = 100101_2. '100101' has three 1's and 3 0's. (End)
		

Crossrefs

Complement of A095071 in A000040. Differs from A057447 first time at n=18, where a(n)=71, while A057447(18)=67. Cf. A095054.

Programs

  • Mathematica
    Select[Prime[Range[50]], DigitCount[#, 2, 0] <= DigitCount[#, 2, 1] &] (* Alonso del Arte, Jan 11 2011 *)
  • PARI
    forprime(p=2,359,v=binary(p);s=0;for(k=1,#v,s+=if(v[k]==0,+1,-1));if(s<=0,print1(p,", "))) \\ Washington Bomfim, Jan 13 2011
    
  • Python
    from sympy import isprime
    i=1
    j=1
    while j<=25000:
        if isprime(i) and bin(i)[2:].count("0")<=bin(i)[2:].count("1"):
            print(str(j)+" "+str(i))
            j+=1
        i+=1 # Indranil Ghosh, Feb 03 2017