OFFSET
1,1
LINKS
Indranil Ghosh, Table of n, a(n) for n = 1..25000
Antti Karttunen and John Moyer, C-program for computing the initial terms of this sequence.
EXAMPLE
From Indranil Ghosh, Feb 03 2017: (Start)
17 is in the sequence because 17_10 = 10001_2. '10001' has two 1's and three 0's.
37 is in the sequence because 37_10 = 100101_2. '100101' has three 1's and 3 0's. (End)
MATHEMATICA
Select[Prime[Range[150]], Differences[DigitCount[#, 2]][[1]] >= 0 &] (* Amiram Eldar, Jul 25 2023 *)
Select[Prime[Range[150]], DigitCount[#, 2, 1]<=DigitCount[#, 2, 0]&] (* Harvey P. Dale, Sep 27 2023 *)
PROG
(PARI) B(x) = {nB = floor(log(x)/log(2)); z1 = 0; z0 = 0;
for(i = 0, nB, if(bittest(x, i), z1++; , z0++; ); );
if(z1 <= z0, return(1); , return(0); ); };
forprime(x = 2, 787, if(B(x), print1(x, ", "); ); );
\\ Washington Bomfim, Jan 11 2011
(Python)
from sympy import isprime
i=1
j=1
while j<=250:
if isprime(i) and bin(i)[2:].count("1")<=bin(i)[2:].count("0"):
print(str(j)+" "+str(i))
j+=1
i+=1 # Indranil Ghosh, Feb 03 2017
CROSSREFS
KEYWORD
nonn,easy,base
AUTHOR
Antti Karttunen, Jun 01 2004
STATUS
approved