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.

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

This page as a plain text file.
%I A095075 #30 Sep 27 2023 16:50:40
%S A095075 2,17,37,41,67,73,97,131,137,139,149,163,193,197,257,263,269,277,281,
%T A095075 293,337,353,389,401,449,521,523,541,547,557,563,569,577,587,593,601,
%U A095075 613,617,641,643,647,653,659,661,673,677,709,769,773,787
%N A095075 Primes in whose binary expansion the number of 1-bits is less than or equal to number of 0-bits.
%H A095075 Indranil Ghosh, <a href="/A095075/b095075.txt">Table of n, a(n) for n = 1..25000</a>
%H A095075 Antti Karttunen and John Moyer, <a href="/A095062/a095062.c.txt">C-program for computing the initial terms of this sequence</a>.
%e A095075 From _Indranil Ghosh_, Feb 03 2017: (Start)
%e A095075 17 is in the sequence because 17_10 = 10001_2. '10001' has two 1's and three 0's.
%e A095075 37 is in the sequence because 37_10 = 100101_2. '100101' has three 1's and 3 0's. (End)
%t A095075 Select[Prime[Range[150]], Differences[DigitCount[#, 2]][[1]] >= 0 &] (* _Amiram Eldar_, Jul 25 2023 *)
%t A095075 Select[Prime[Range[150]],DigitCount[#,2,1]<=DigitCount[#,2,0]&] (* _Harvey P. Dale_, Sep 27 2023 *)
%o A095075 (PARI) B(x) = {nB = floor(log(x)/log(2)); z1 = 0; z0 = 0;
%o A095075 for(i = 0, nB, if(bittest(x,i), z1++;, z0++;); );
%o A095075 if(z1 <= z0, return(1);, return(0););};
%o A095075 forprime(x = 2, 787, if(B(x), print1(x, ", "); ); );
%o A095075 \\ _Washington Bomfim_, Jan 11 2011
%o A095075 (Python)
%o A095075 from sympy import isprime
%o A095075 i=1
%o A095075 j=1
%o A095075 while j<=250:
%o A095075     if isprime(i) and bin(i)[2:].count("1")<=bin(i)[2:].count("0"):
%o A095075         print(str(j)+" "+str(i))
%o A095075         j+=1
%o A095075     i+=1 # _Indranil Ghosh_, Feb 03 2017
%Y A095075 Complement of A095070 in A000040.
%Y A095075 Cf. A095055.
%K A095075 nonn,easy,base
%O A095075 1,1
%A A095075 _Antti Karttunen_, Jun 01 2004