OFFSET
1,1
COMMENTS
If the sum of primes p and q is a prime r, then one of p and q must be 2. - N. J. A. Sloane, May 01 2016
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..10859
Michel Marcus, 3 primes
EXAMPLE
a(3) = 79, its binary representation is 1001111 with (prime) 7 digits, (prime) 5 1's and (prime) 2 0's.
MATHEMATICA
Select[Table[Prime[j], {j, 1, 120000}], PrimeQ[Total@IntegerDigits[#, 2]]&&PrimeQ[Length@IntegerDigits[#, 2]]&&PrimeQ[(Length@IntegerDigits[#, 2]-Total@IntegerDigits[#, 2])]&]
Select[Prime@ Range[10^5], And[PrimeQ@ Total@ #, PrimeQ@ First@ #, PrimeQ@ Last@ #] &@ DigitCount[#, 2] &] (* Michael De Vlieger, May 01 2016 *)
PROG
(PARI) isok(n) = isprime(n) && isprime(#binary(n)) && isprime(hammingweight(n)) && isprime(#binary(n) - hammingweight(n)); \\ Michel Marcus, May 01 2016
(Python)
from sympy import isprime, nextprime
from itertools import combinations, islice
def agen(): # generator of terms
p = 2
while True:
p = nextprime(p)
if not isprime(p+2): continue
if isprime(t:=(1<<(p+1))+1): yield t
b = (1<<(p+2))-1
for i, j in combinations(range(p), 2):
if isprime(t:=b-(1<<(p-i))-(1<<(p-j))):
yield t
print(list(islice(agen(), 43))) # Michael S. Branicky, Dec 27 2023
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Andres Cicuttin, May 01 2016
STATUS
approved