login
Primes with two 0-bits in their binary expansion.
3

%I #15 Dec 27 2023 11:58:12

%S 19,43,53,79,103,107,109,367,379,431,439,443,463,487,491,499,751,863,

%T 887,983,1013,1279,1471,1531,1663,1759,1783,1787,1789,1951,1979,1999,

%U 2011,2027,2029,3067,3581,3823,4027,5119,6079,6911,7039,7103

%N Primes with two 0-bits in their binary expansion.

%H Alois P. Heinz, <a href="/A095079/b095079.txt">Table of n, a(n) for n = 1..10000</a>

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

%t Select[Prime[Range[1000]], DigitCount[#, 2, 0] == 2 &]

%o (PARI)

%o { forprime(p=2,8000,

%o v=binary(p); s=0;

%o for(k=1,#v, s+=if(v[k]==0,+1,0));

%o if(s==2,print1(p,", "))

%o ) }

%o (Python)

%o from sympy import isprime

%o from itertools import combinations, count, islice

%o def agen(): # generator of terms

%o for d in count(2):

%o b = (1<<(d+2))-1

%o for i, j in combinations(range(d), 2):

%o if isprime(t:=b-(1<<(d-i))-(1<<(d-j))):

%o yield t

%o print(list(islice(agen(), 43))) # _Michael S. Branicky_, Dec 27 2023

%Y Cf. A095059.

%K nonn,base,easy

%O 1,1

%A _Antti Karttunen_, Jun 01 2004