OFFSET
1,1
LINKS
T. D. Noe, Table of n, a(n) for n = 1..1000
A. Karttunen and J. Moyer, C-program for computing the initial terms of this sequence
MATHEMATICA
Select[Prime[Range[320]], Plus@@IntegerDigits[#, 2] == 4 &] (* Alonso del Arte, Jan 11 2011 *)
Select[ Flatten[ Table[2^i + 2^j + 2^k + 1, {i, 3, 11}, {j, 2, i - 1}, {k, j - 1}]], PrimeQ] (* Robert G. Wilson v, Jul 30 2016 *)
PROG
(PARI) bits1_4(x) = { nB = floor(log(x)/log(2)); z = 0;
for(i=0, nB, if(bittest(x, i), z++; if(z>4, return(0); ); ); );
if(z == 4, return(1); , return(0); ); };
forprime(x=17, 2129, if(bits1_4(x), print1(x, ", "); ); );
\\ Washington Bomfim, Jan 11 2011
(PARI) is(n)=isprime(n) && hammingweight(n)==4 \\ Charles R Greathouse IV, Jul 30 2016
(PARI) list(lim)=my(v=List(), t); for(a=3, logint(lim\=1, 2), for(b=2, a-1, for(c=1, b-1, t=1<<a + 1<<b + 1<<c + 1; if(t>lim, return(Vec(v))); if(isprime(t), listput(v, t))))); Vec(v) \\ Charles R Greathouse IV, Jul 30 2016
(Python)
from itertools import count, islice
from sympy import isprime
from sympy.utilities.iterables import multiset_permutations
def A095077_gen(): # generator of terms
return filter(isprime, map(lambda s:int('1'+''.join(s)+'1', 2), (s for l in count(2) for s in multiset_permutations('0'*(l-2)+'11'))))
CROSSREFS
KEYWORD
nonn,easy,base
AUTHOR
Antti Karttunen, Jun 01 2004
STATUS
approved