login
Primes in whose binary expansion the number of 1 bits is > 4 + number of 0 bits.
4

%I #13 Mar 04 2015 20:29:30

%S 31,127,191,223,239,251,367,379,383,431,439,443,463,479,487,491,499,

%T 503,509,751,863,887,983,991,1013,1019,1021,1151,1277,1279,1399,1439,

%U 1471,1487,1499,1511,1523,1531,1663,1723,1759,1783,1787,1789,1823

%N Primes in whose binary expansion the number of 1 bits is > 4 + number of 0 bits.

%H A. Karttunen and J. Moyer: <a href="/A095062/a095062.c.txt">C-program for computing the initial terms of this sequence</a>

%t btsQ[n_]:=Module[{idn2=IntegerDigits[n,2]},Count[idn2,1]>4+Count[ idn2,0]]; Select[Prime[Range[300]],btsQ] (* _Harvey P. Dale_, Nov 12 2011 *)

%o (PARI) B(x) = { nB = floor(log(x)/log(2)); b1 = 0; b0 = 0;

%o for(i = 0, nB, if(bittest(x,i), b1++;, b0++;); );

%o if(b1 > (4+b0), return(1);, return(0););};

%o forprime(x = 2, 1823, if(B(x), print1(x, ", "); ); ); \\ _Washington Bomfim_, Jan 12 2011

%Y Complement of A095323 in A000040. Subset of A095318. Subset: A095284. Cf. also A095324.

%K nonn,easy

%O 1,1

%A _Antti Karttunen_, Jun 04 2004